Interface NonBlockingTransaction
- All Known Implementing Classes:
AuthenticationSessionChangeLogTransaction,ClientSessionChangeLogTransaction,ClientSessionPersistentChangelogBasedTransaction,InfinispanChangelogBasedTransaction,InfinispanKeycloakTransaction,LoginFailureChangeLogTransaction,PersistentSessionsChangelogBasedTransaction,RemoteChangeLogTransaction,SingleUseObjectTransaction,UserSessionChangeLogTransaction,UserSessionInfinispanChangelogBasedTransaction,UserSessionPersistentChangelogBasedTransaction,UserSessionTransaction
public interface NonBlockingTransaction
Represents a non-blocking transaction.
The commit and rollback operations should not block the invoker thread and register any CompletionStage into
the AggregateCompletionStage. The invoker is responsible to provide the AggregateCompletionStage and
to wait for its completion.
-
Method Summary
Modifier and TypeMethodDescriptionvoidasyncCommit(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage, Consumer<DatabaseUpdate> databaseUpdates) Asynchronously commits the transaction.voidasyncRollback(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage) Asynchronously rollbacks the transaction.default booleanLocking any entities that are about to be updated.default booleanThis transaction connects to entities in the database.
-
Method Details
-
asyncCommit
void asyncCommit(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage, Consumer<DatabaseUpdate> databaseUpdates) Asynchronously commits the transaction.The implementation should not block the thread and add any (or none)
CompletionStageinto thestage.Any blocking operation should be consumed by the
databaseUpdates. It will be executed at a later instant.- Parameters:
stage- TheAggregateCompletionStageto collect theCompletionStage.databaseUpdates- TheConsumerto use for blocking/database updates.
-
asyncRollback
Asynchronously rollbacks the transaction.The implementation should not block the thread and add any (or none)
CompletionStageinto thestage.- Parameters:
stage- TheAggregateCompletionStageto collect theCompletionStage.
-
supportsLockingDatabaseEntities
default boolean supportsLockingDatabaseEntities()This transaction connects to entities in the database.- Returns:
- When this returns true, this has entities in the database
-
lockDatabaseEntities
default boolean lockDatabaseEntities()Locking any entities that are about to be updated.- Returns:
- When this returns true, there is either no entity to be locked, or all entities are now locked and it is unlikely that the transaction will roll back.
-