Class UserSessionTransaction
java.lang.Object
org.keycloak.models.sessions.infinispan.remote.transaction.UserSessionTransaction
- All Implemented Interfaces:
NonBlockingTransaction
A
KeycloakTransaction implementation that wraps all the user and client session transactions.
This implementation commits all modifications asynchronously and concurrently in both user and client sessions transactions. Waits for all them to complete. This is an optimization to reduce the response time.
-
Constructor Summary
ConstructorsConstructorDescriptionUserSessionTransaction(UserSessionChangeLogTransaction userSessions, UserSessionChangeLogTransaction offlineUserSessions, ClientSessionChangeLogTransaction clientSessions, ClientSessionChangeLogTransaction offlineClientSessions) -
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.getClientSessions(boolean offline) getUserSessions(boolean offline) voidremoveAllSessionByUserId(String realmId, String userId) voidremoveAllSessionsByRealmId(String realmId) voidremoveOnlineSessionsByRealmId(String realmId) voidremoveUserSessionById(String userSessionId, boolean offline)
-
Constructor Details
-
UserSessionTransaction
public UserSessionTransaction(UserSessionChangeLogTransaction userSessions, UserSessionChangeLogTransaction offlineUserSessions, ClientSessionChangeLogTransaction clientSessions, ClientSessionChangeLogTransaction offlineClientSessions)
-
-
Method Details
-
asyncCommit
public void asyncCommit(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage, Consumer<DatabaseUpdate> databaseUpdates) Description copied from interface:NonBlockingTransactionAsynchronously 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.- Specified by:
asyncCommitin interfaceNonBlockingTransaction- Parameters:
stage- TheAggregateCompletionStageto collect theCompletionStage.databaseUpdates- TheConsumerto use for blocking/database updates.
-
asyncRollback
public void asyncRollback(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage) Description copied from interface:NonBlockingTransactionAsynchronously rollbacks the transaction.The implementation should not block the thread and add any (or none)
CompletionStageinto thestage.- Specified by:
asyncRollbackin interfaceNonBlockingTransaction- Parameters:
stage- TheAggregateCompletionStageto collect theCompletionStage.
-
getClientSessions
-
getUserSessions
-
removeAllSessionsByRealmId
-
removeOnlineSessionsByRealmId
-
removeAllSessionByUserId
-
removeUserSessionById
-