public abstract class BlockingIdentifierGenerator extends java.lang.Object implements ReactiveIdentifierGenerator<java.lang.Long>
ReactiveIdentifierGenerator
which uses the database to allocate
blocks of ids. A block is identified by its "hi" value (the first id in
the block). While a new block is being allocated, concurrent streams wait
without blocking.Constructor and Description |
---|
BlockingIdentifierGenerator() |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletionStage<java.lang.Long> |
generate(ReactiveConnectionSupplier session,
java.lang.Object entity)
Returns a generated identifier, via a
CompletionStage . |
protected abstract int |
getBlockSize()
The block size (the number of "lo" values for each "hi" value)
|
protected long |
next() |
protected long |
next(long hi) |
protected abstract java.util.concurrent.CompletionStage<java.lang.Long> |
nextHiValue(ReactiveConnectionSupplier session)
Allocate a new block, by obtaining the next "hi" value from the database
|
protected abstract int getBlockSize()
protected abstract java.util.concurrent.CompletionStage<java.lang.Long> nextHiValue(ReactiveConnectionSupplier session)
protected long next()
protected long next(long hi)
public java.util.concurrent.CompletionStage<java.lang.Long> generate(ReactiveConnectionSupplier session, java.lang.Object entity)
ReactiveIdentifierGenerator
CompletionStage
.generate
in interface ReactiveIdentifierGenerator<java.lang.Long>
session
- the reactive session