|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fasterxml.uuid.TimestampSynchronizer
public abstract class TimestampSynchronizer
This is the API for utility classes optionally used by UUIDTimer
to
ensure that timestamp values used for generating time/location-based UUIDs
are monotonically increasing, as well as that only one such generator
is ever used on a single system, even in presence of multiple JVMs.
The default implementation used by JUG is
FileBasedTimestampSynchronizer
.
Constructor Summary | |
---|---|
protected |
TimestampSynchronizer()
|
Method Summary | |
---|---|
protected abstract void |
deactivate()
Method UUIDTimer will call if this synchronizer object is
being replaced by another synchronizer (or removed, that is, no
more synchronization is to be done). |
protected abstract long |
initialize()
Initialization method is will be called on an instance by UUIDTimer right after it's been configured with one. |
protected abstract long |
update(long now)
Method called by UUIDTimer to indicate that it has generated
a timestamp value that is beyond last legal timestamp value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected TimestampSynchronizer()
Method Detail |
---|
protected abstract long initialize() throws IOException
UUIDTimer
right after it's been configured with one.
At this point the implementation instance should have been properly
configured, and should be able to determine the first legal timestamp
value (return value). Method should also initialize any locking that
it does (if any), such as locking files it needs.
Return value thus indicates the lowest initial time value that can
be used by the caller that can not have been used by previous
incarnations of the UUID generator (assuming instance was able to
find properly persisted data to figure that out).
However, caller also needs to make sure that it will
call update(long)
when it actually needs the time stamp for the
first time,
since this method can not allocate timestamps beyond this initial
value at this point.
0L
if it
can not
determine it and caller can use whatever value (current timestamp)
it has access to.
IOException
protected abstract void deactivate() throws IOException
UUIDTimer
will call if this synchronizer object is
being replaced by another synchronizer (or removed, that is, no
more synchronization is to be done). It will not be called if JVM
terminates.
IOException
protected abstract long update(long now) throws IOException
UUIDTimer
to indicate that it has generated
a timestamp value that is beyond last legal timestamp value.
The method should only return once it has "locked" specified timestamp
value (and possible additional ones).
now
- Timestamp value caller wants to use, and that the
synchronizer is asked to protect.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |