Class RemoteCacheSessionsLoader
java.lang.Object
org.keycloak.models.sessions.infinispan.remotestore.RemoteCacheSessionsLoader
- All Implemented Interfaces:
SessionLoader<RemoteCacheSessionsLoaderContext,
SessionLoader.WorkerContext, SessionLoader.WorkerResult>
public class RemoteCacheSessionsLoader
extends Object
implements SessionLoader<RemoteCacheSessionsLoaderContext,SessionLoader.WorkerContext,SessionLoader.WorkerResult>
- Author:
- Marek Posolda
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.models.sessions.infinispan.initializer.SessionLoader
SessionLoader.LoaderContext, SessionLoader.WorkerContext, SessionLoader.WorkerResult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Callback triggered on cluster coordinator once it recognize that all sessions were successfully loadedWill be triggered just once on cluster coordinator node to count the number of segments and other context data specific to whole computation.computeWorkerContext
(int segment) Compute the worker context for current iterationprotected org.infinispan.Cache
getCache
(KeycloakSession session) protected org.infinispan.client.hotrod.RemoteCache
getRemoteCache
(KeycloakSession session) loadSessions
(KeycloakSession session, RemoteCacheSessionsLoaderContext loaderContext, SessionLoader.WorkerContext ctx) Will be called on all cluster nodes to load the specified page.toString()
-
Constructor Details
-
RemoteCacheSessionsLoader
-
-
Method Details
-
computeLoaderContext
Description copied from interface:SessionLoader
Will be triggered just once on cluster coordinator node to count the number of segments and other context data specific to whole computation. Each segment will be then later computed in one "worker" task This method could be expensive to call, so the "computed" loaderContext object is passed among workers/loaders and needs to be serializable- Specified by:
computeLoaderContext
in interfaceSessionLoader<RemoteCacheSessionsLoaderContext,
SessionLoader.WorkerContext, SessionLoader.WorkerResult> - Returns:
-
computeWorkerContext
Description copied from interface:SessionLoader
Compute the worker context for current iteration- Specified by:
computeWorkerContext
in interfaceSessionLoader<RemoteCacheSessionsLoaderContext,
SessionLoader.WorkerContext, SessionLoader.WorkerResult> - Parameters:
segment
- the current segment (page) to compute- Returns:
-
loadSessions
public SessionLoader.WorkerResult loadSessions(KeycloakSession session, RemoteCacheSessionsLoaderContext loaderContext, SessionLoader.WorkerContext ctx) Description copied from interface:SessionLoader
Will be called on all cluster nodes to load the specified page.- Specified by:
loadSessions
in interfaceSessionLoader<RemoteCacheSessionsLoaderContext,
SessionLoader.WorkerContext, SessionLoader.WorkerResult> loaderContext
- global loaderContext object, which was already computed beforectx
- for current iteration- Returns:
-
afterAllSessionsLoaded
public void afterAllSessionsLoaded()Description copied from interface:SessionLoader
Callback triggered on cluster coordinator once it recognize that all sessions were successfully loaded- Specified by:
afterAllSessionsLoaded
in interfaceSessionLoader<RemoteCacheSessionsLoaderContext,
SessionLoader.WorkerContext, SessionLoader.WorkerResult>
-
getCache
-
getRemoteCache
-
toString
-