public interface SessionLoader<LOADER_CONTEXT extends SessionLoader.LoaderContext,WORKER_CONTEXT extends SessionLoader.WorkerContext,WORKER_RESULT extends SessionLoader.WorkerResult> extends Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
SessionLoader.LoaderContext
Object, which contains some context data to be used by SessionLoader implementation.
|
static class |
SessionLoader.WorkerContext
Object, which is computed before each worker iteration and contains some data to be used by the corresponding worker iteration.
|
static class |
SessionLoader.WorkerResult
Result of single worker iteration
|
Modifier and Type | Method and Description |
---|---|
void |
afterAllSessionsLoaded(BaseCacheInitializer initializer)
Callback triggered on cluster coordinator once it recognize that all sessions were successfully loaded
|
LOADER_CONTEXT |
computeLoaderContext(KeycloakSession session)
Will be triggered just once on cluster coordinator node to count the number of segments and other context data specific to whole computation.
|
WORKER_CONTEXT |
computeWorkerContext(LOADER_CONTEXT loaderCtx,
int segment,
int workerId,
WORKER_RESULT previousResult)
Compute the worker context for current iteration
|
WORKER_RESULT |
createFailedWorkerResult(LOADER_CONTEXT loaderContext,
WORKER_CONTEXT workerContext)
Called when it's not possible to compute current iteration and load session for some reason (EG.
|
void |
init(KeycloakSession session)
Will be triggered just once on cluster coordinator node to perform some generic initialization tasks (Eg.
|
boolean |
isFinished(BaseCacheInitializer initializer)
This will be called on nodes to check if loading is finished.
|
WORKER_RESULT |
loadSessions(KeycloakSession session,
LOADER_CONTEXT loaderContext,
WORKER_CONTEXT workerContext)
Will be called on all cluster nodes to load the specified page.
|
void init(KeycloakSession session)
session
- LOADER_CONTEXT computeLoaderContext(KeycloakSession session)
session
- WORKER_CONTEXT computeWorkerContext(LOADER_CONTEXT loaderCtx, int segment, int workerId, WORKER_RESULT previousResult)
loaderCtx
- global loader contextsegment
- the current segment (page) to computeworkerId
- ID of worker for current worker iteration. Usually the number 0-8 (with single cluster node)previousResult
- last workerResult from previous computation. Can be empty list in case of the operation is triggered for the 1st timeWORKER_RESULT loadSessions(KeycloakSession session, LOADER_CONTEXT loaderContext, WORKER_CONTEXT workerContext)
session
- loaderContext
- global loaderContext object, which was already computed beforeworkerContext
- for current iterationWORKER_RESULT createFailedWorkerResult(LOADER_CONTEXT loaderContext, WORKER_CONTEXT workerContext)
loaderContext
- workerContext
- boolean isFinished(BaseCacheInitializer initializer)
initializer
- void afterAllSessionsLoaded(BaseCacheInitializer initializer)
initializer
- Copyright © 2021 JBoss by Red Hat. All rights reserved.