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 TypeMethodDescriptionvoid
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.getClientSessions
(boolean offline) getUserSessions
(boolean offline) void
removeAllSessionByUserId
(String realmId, String userId) void
removeAllSessionsByRealmId
(String realmId) void
removeOnlineSessionsByRealmId
(String realmId) void
removeUserSessionById
(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:NonBlockingTransaction
Asynchronously commits the transaction.The implementation should not block the thread and add any (or none)
CompletionStage
into thestage
.Any blocking operation should be consumed by the
databaseUpdates
. It will be executed at a later instant.- Specified by:
asyncCommit
in interfaceNonBlockingTransaction
- Parameters:
stage
- TheAggregateCompletionStage
to collect theCompletionStage
.databaseUpdates
- TheConsumer
to use for blocking/database updates.
-
asyncRollback
public void asyncRollback(org.infinispan.commons.util.concurrent.AggregateCompletionStage<Void> stage) Description copied from interface:NonBlockingTransaction
Asynchronously rollbacks the transaction.The implementation should not block the thread and add any (or none)
CompletionStage
into thestage
.- Specified by:
asyncRollback
in interfaceNonBlockingTransaction
- Parameters:
stage
- TheAggregateCompletionStage
to collect theCompletionStage
.
-
getClientSessions
-
getUserSessions
-
removeAllSessionsByRealmId
-
removeOnlineSessionsByRealmId
-
removeAllSessionByUserId
-
removeUserSessionById
-