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 Type
    Method
    Description
    void
    asyncCommit(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage, Consumer<DatabaseUpdate> databaseUpdates)
    Asynchronously commits the transaction.
    void
    asyncRollback(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage)
    Asynchronously rollbacks the transaction.
    default boolean
    Locking any entities that are about to be updated.
    default boolean
    This 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) CompletionStage into the stage.

      Any blocking operation should be consumed by the databaseUpdates. It will be executed at a later instant.

      Parameters:
      stage - The AggregateCompletionStage to collect the CompletionStage.
      databaseUpdates - The Consumer to use for blocking/database updates.
    • asyncRollback

      void asyncRollback(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage)
      Asynchronously rollbacks the transaction.

      The implementation should not block the thread and add any (or none) CompletionStage into the stage.

      Parameters:
      stage - The AggregateCompletionStage to collect the CompletionStage.
    • 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.