|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface State
The State
interface. Implementors are responsible for storing
UUIDGenerator stateful information. Each node contains the last timestamp,
the last clock sequence used, and the node identifier bytes. The implementor
should be prepared to load, store, and return the Node
s from
some stateful storage.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_STATE_IMPL
The default State implementation class name if not configured. |
Method Summary | |
---|---|
java.util.Set |
getNodes()
Returns the collection of Nodes for this uuid state
information. |
long |
getSynchInterval()
Returns the number of milliseconds to wait between writing to stable storage. |
void |
load()
Method loads the Systems node identifier information usually from some stateful storage area. |
void |
store(java.util.Set nodes)
Stores the state information. |
void |
store(java.util.Set nodes,
long timestamp)
Stores the state information using a predetermined timestamp. |
Field Detail |
---|
static final java.lang.String DEFAULT_STATE_IMPL
State
implementation class name if not configured.
Method Detail |
---|
void load() throws java.lang.Exception
Method loads the Systems node identifier information usually from some stateful storage area.
Note each JVM instance should have a separate configuration since a system wide Mutex is not feasible, then in a system with multiple concurrent jvm instances running - each instance should utilize a different configuration with distinct node identifiers.
java.lang.IllegalStateException
- likely the system is not configured or the state of the system is incorrect.
java.lang.Exception
java.util.Set getNodes()
Returns the collection of Nodes
for this uuid state
information.
Nodes
for this uuid state.void store(java.util.Set nodes) throws java.io.IOException
Stores the state information.
To increase the quality of the UUID uniqueness, a system that may write to stable storage SHOULD perist the state of the UUIDGenerator in order to reduce the likelihood of duplicate identifiers and increase the quality of the identifiers generated.
nodes
- a Collection of Node
s to store.
java.io.IOException
- - an input/output Exception perhaps due to StringBuffer#appendvoid store(java.util.Set nodes, long timestamp)
Stores the state information using a predetermined timestamp. This timestamp should be a time in the future but a shorter period than what the java virtual machine can restart within. This is normally linked to the sychInterval.
Using a point in time in the near future reduces unnecessary I/O, while allowing for the persistent state to be stored periodically, in an efficient manner.
nodes
- a Collection of Node
s to store.timestamp
- the timestamp to write all Node
s last timestamp as.long getSynchInterval()
Returns the number of milliseconds to wait between writing to stable storage.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |