public class ESUIDSequencer extends AbstractUIDSequencer
UIDSequencer.
Since elasticsearch does not seem to support a notion of native sequence, the implementation uses the auto-increment of the version attribute as described in the ElasticSearch::Sequence - a blazing fast ticket server blog post.
| Modifier and Type | Field and Description |
|---|---|
protected ESClient |
esClient |
protected String |
indexName |
protected static int |
MAX_RETRY |
name| Constructor and Description |
|---|
ESUIDSequencer() |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Cleanup callback
|
List<Long> |
getNextBlock(String key,
int blockSize)
Returns a block containing
blockSize sequences. |
protected long |
getNextBlockWithRetry(String key,
int blockSize) |
long |
getNextLong(String sequenceName)
Extends
UIDSequencer.getNext(java.lang.String) to return a long value. |
void |
init()
Init Sequencer
|
void |
initSequence(String key,
long id)
Initializes the sequencer with the given key to at least the given long id.
|
getName, getNext, initSequence, setNameprotected static final int MAX_RETRY
public ESUIDSequencer()
public void init()
UIDSequencerpublic void dispose()
UIDSequencerpublic void initSequence(String key, long id)
UIDSequencerA sequence can only be incremented, so if its current id is greater than the given id the sequence won't be decremented to reach the given id.
initSequence in interface UIDSequencerinitSequence in class AbstractUIDSequencerpublic long getNextLong(String sequenceName)
UIDSequencerUIDSequencer.getNext(java.lang.String) to return a long value. This method is compatible
with getNext in the integer range.public List<Long> getNextBlock(String key, int blockSize)
UIDSequencerblockSize sequences.protected long getNextBlockWithRetry(String key, int blockSize)
Copyright © 2019 Nuxeo. All rights reserved.