Package org.hibernate.reactive.id.impl
Class BlockingIdentifierGenerator
java.lang.Object
org.hibernate.reactive.id.impl.BlockingIdentifierGenerator
- All Implemented Interfaces:
Serializable,org.hibernate.generator.Generator,ReactiveIdentifierGenerator<Long>
- Direct Known Subclasses:
ReactiveSequenceIdentifierGenerator,TableReactiveIdentifierGenerator
public abstract class BlockingIdentifierGenerator
extends Object
implements ReactiveIdentifierGenerator<Long>
A
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 will
defer the operation without blocking.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(ReactiveConnectionSupplier connectionSupplier, Object ignored) Returns a generated identifier, via aCompletionStage.protected abstract intThe block size (the number of "lo" values for each "hi" value)protected abstract CompletionStage<Long>nextHiValue(ReactiveConnectionSupplier session) Allocate a new block, by obtaining the next "hi" value from the databaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.generator.Generator
allowAssignedIdentifiers, allowMutation, generatedBeforeExecution, generatedOnExecution, generatedOnExecution, generatesOnForceIncrement, generatesOnInsert, generatesOnUpdate, generatesSometimes, getEventTypesMethods inherited from interface org.hibernate.reactive.id.ReactiveIdentifierGenerator
generate
-
Constructor Details
-
BlockingIdentifierGenerator
public BlockingIdentifierGenerator()
-
-
Method Details
-
getBlockSize
protected abstract int getBlockSize()The block size (the number of "lo" values for each "hi" value) -
nextHiValue
Allocate a new block, by obtaining the next "hi" value from the database -
generate
public CompletionStage<Long> generate(ReactiveConnectionSupplier connectionSupplier, Object ignored) Description copied from interface:ReactiveIdentifierGeneratorReturns a generated identifier, via aCompletionStage.- Specified by:
generatein interfaceReactiveIdentifierGenerator<Long>- Parameters:
connectionSupplier- the reactive session
-