Package org.hibernate.reactive.id.impl
Class BlockingIdentifierGenerator
- java.lang.Object
-
- org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
-
- All Implemented Interfaces:
ReactiveIdentifierGenerator<java.lang.Long>
- Direct Known Subclasses:
ReactiveSequenceIdentifierGenerator
,TableReactiveIdentifierGenerator
public abstract class BlockingIdentifierGenerator extends java.lang.Object implements ReactiveIdentifierGenerator<java.lang.Long>
AReactiveIdentifierGenerator
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 will defer the operation without blocking.
-
-
Constructor Summary
Constructors Constructor Description BlockingIdentifierGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletionStage<java.lang.Long>
generate(ReactiveConnectionSupplier connectionSupplier, java.lang.Object ignored)
Returns a generated identifier, via aCompletionStage
.protected abstract int
getBlockSize()
The block size (the number of "lo" values for each "hi" value)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
-
-
-
Method Detail
-
getBlockSize
protected abstract int getBlockSize()
The block size (the number of "lo" values for each "hi" value)
-
nextHiValue
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
-
generate
public java.util.concurrent.CompletionStage<java.lang.Long> generate(ReactiveConnectionSupplier connectionSupplier, java.lang.Object ignored)
Description copied from interface:ReactiveIdentifierGenerator
Returns a generated identifier, via aCompletionStage
.- Specified by:
generate
in interfaceReactiveIdentifierGenerator<java.lang.Long>
- Parameters:
connectionSupplier
- the reactive session
-
-