Interface SessionLoader<LOADER_CONTEXT extends SessionLoader.LoaderContext,WORKER_CONTEXT extends SessionLoader.WorkerContext,WORKER_RESULT extends SessionLoader.WorkerResult>

All Superinterfaces:
Serializable
All Known Implementing Classes:
RemoteCacheSessionsLoader

public interface SessionLoader<LOADER_CONTEXT extends SessionLoader.LoaderContext,WORKER_CONTEXT extends SessionLoader.WorkerContext,WORKER_RESULT extends SessionLoader.WorkerResult> extends Serializable
Author:
Marek Posolda
  • 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

      WORKER_CONTEXT computeWorkerContext(int segment)
      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 before
      workerContext - for current iteration
      Returns:
    • afterAllSessionsLoaded

      void afterAllSessionsLoaded()
      Callback triggered on cluster coordinator once it recognize that all sessions were successfully loaded