|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Classes implementing this interface allow access to a shared storage of
ids to use with a SequentialUniqueIdGenerator
.
The storage can be slow, for example based on a remote object access or a database.
Nested Class Summary | |
static class |
SequentialUniqueIdGenerator.IdStorage.IdStorageException
|
Method Summary | |
java.util.Iterator |
getNextIdBlock()
Return an iterator over the next block of ids. |
void |
lock()
Lock the storage. |
void |
unlock()
Unlock the storage. |
Method Detail |
public void lock() throws SequentialUniqueIdGenerator.IdStorage.IdStorageException
This method attempts to gain control of the storage and must block until the control is obtained or a timeout is expired.
SequentialUniqueIdGenerator.IdStorage.IdStorageException
- if the lock cannot be obtainedpublic java.util.Iterator getNextIdBlock() throws SequentialUniqueIdGenerator.IdStorage.IdStorageException, java.lang.IllegalStateException
next()
operation of the iterator may return any
object, but their string representation will be used. Therefore, the
iterator must return a sequence of objects whose string
representation is unique.
The storage must be left in a state such another process will not retrieve the same block.
SequentialUniqueIdGenerator.IdStorage.IdStorageException
- if an exception occurs while using the
SequentialUniqueIdGenerator.IdStorage
java.lang.IllegalStateException
- if the storage is unlockedpublic void unlock() throws SequentialUniqueIdGenerator.IdStorage.IdStorageException
This method must release control of the storage.
SequentialUniqueIdGenerator.IdStorage.IdStorageException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |