org.keycloak.models.sessions.infinispan.initializer

## Class DBLockBasedCacheInitializer

- java.lang.Object
- - org.keycloak.models.sessions.infinispan.initializer.CacheInitializer
  - - org.keycloak.models.sessions.infinispan.initializer.DBLockBasedCacheInitializer

-     public class DBLockBasedCacheInitializer
      extends CacheInitializer

  Encapsulates preloading of sessions within the DB Lock. This DB-aware lock ensures that "startLoading" is done on single DC and the other DCs need to wait.
  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DBLockBasedCacheInitializer(KeycloakSession session, CacheInitializer delegate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `initCache()`
    `protected boolean` | `isCoordinator()`
    `protected boolean` | `isFinished()`
    `protected void` | `startLoading()` Just coordinator will run this.

    - ### Methods inherited from class org.keycloak.models.sessions.infinispan.initializer.CacheInitializer

      `loadSessions`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DBLockBasedCacheInitializer

          public DBLockBasedCacheInitializer(KeycloakSession session,
                                             CacheInitializer delegate)

  - ### Method Detail

    - #### initCache

          public void initCache()

      Overrides:
        `initCache` in class `CacheInitializer`

    - #### isFinished

          protected boolean isFinished()

      Specified by:
        `isFinished` in class `CacheInitializer`

    - #### isCoordinator

          protected boolean isCoordinator()

      Specified by:
        `isCoordinator` in class `CacheInitializer`

    - #### startLoading

          protected void startLoading()

      Just coordinator will run this. And there is DB-lock, so the delegate.startLoading() will be permitted just by the single DC
      Specified by:
        `startLoading` in class `CacheInitializer`

Copyright © 2021 JBoss by Red Hat. All rights reserved.