public class SequentialPrimaryKeyGenerator extends Object implements PrimaryKeyGenerator
Returns unique primary keys in sequential order. Delegates to a SequentialPrimaryKeyPersistence
implementation for cluster-safe generation and persistence of primary
keys. This implementation is thread-safe.
Constructor and Description |
---|
SequentialPrimaryKeyGenerator(SequentialPrimaryKeyPersistence primaryKeyPersistence,
int blockSize)
Create a new instance that delegates actual primary key generation to the given primary key persistence.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
getNextPrimaryKey(Class<T> expectedType)
Generates the next primary key.
|
public SequentialPrimaryKeyGenerator(SequentialPrimaryKeyPersistence primaryKeyPersistence, int blockSize)
Create a new instance that delegates actual primary key generation to the given primary key persistence. Each block of primary keys returned by the primary key persistence delegate will be of the given block size.
primaryKeyPersistence
- the primary key persistence that generates the actual primary keysblockSize
- the number of primary keys to fetch from the primary key persistencepublic <T> T getNextPrimaryKey(Class<T> expectedType)
Generates the next primary key.
getNextPrimaryKey
in interface PrimaryKeyGenerator
T
- the type of the classexpectedType
- the expected type of the keyCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.