Interface SessionLoader<LOADER_CONTEXT extends SessionLoader.LoaderContext,WORKER_CONTEXT extends SessionLoader.WorkerContext,WORKER_RESULT extends SessionLoader.WorkerResult>
- All Known Implementing Classes:
RemoteCacheSessionsLoader
public interface SessionLoader<LOADER_CONTEXT extends SessionLoader.LoaderContext,WORKER_CONTEXT extends SessionLoader.WorkerContext,WORKER_RESULT extends SessionLoader.WorkerResult>
- Author:
- Marek Posolda
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Object, which contains some context data to be used by SessionLoader implementation.static final record
Object, which is computed before each worker iteration and contains some data to be used by the corresponding worker iteration.static final record
Result of single worker iteration -
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 iterationloadSessions
(KeycloakSession session, LOADER_CONTEXT loaderContext, WORKER_CONTEXT workerContext) Will be called on all cluster nodes to load the specified page.
-
Method Details
-
computeLoaderContext
LOADER_CONTEXT computeLoaderContext()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- Returns:
-
computeWorkerContext
Compute the worker context for current iteration- Parameters:
segment
- the current segment (page) to compute- Returns:
-
loadSessions
WORKER_RESULT loadSessions(KeycloakSession session, LOADER_CONTEXT loaderContext, WORKER_CONTEXT workerContext) Will be called on all cluster nodes to load the specified page.- Parameters:
session
-loaderContext
- global loaderContext object, which was already computed beforeworkerContext
- for current iteration- Returns:
-
afterAllSessionsLoaded
void afterAllSessionsLoaded()Callback triggered on cluster coordinator once it recognize that all sessions were successfully loaded
-