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 Description DBLockBasedCacheInitializer(KeycloakSession session, CacheInitializer delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getProgressIndicator()
Returns an integer which captures current progress.protected int
getStalledTimeoutInSeconds()
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
-
-
-
-
Constructor Detail
-
DBLockBasedCacheInitializer
public DBLockBasedCacheInitializer(KeycloakSession session, CacheInitializer delegate)
-
-
Method Detail
-
initCache
public void initCache()
- Overrides:
initCache
in classCacheInitializer
-
isFinished
protected boolean isFinished()
- Specified by:
isFinished
in classCacheInitializer
-
isCoordinator
protected boolean isCoordinator()
- Specified by:
isCoordinator
in classCacheInitializer
-
getProgressIndicator
protected int getProgressIndicator()
Description copied from class:CacheInitializer
Returns an integer which captures current progress. If there is a progress in loading, this indicator must be different most of the time so that it does not hit 30-seconds limit.- Specified by:
getProgressIndicator
in classCacheInitializer
- Returns:
- See Also:
#stalledTimeoutInSeconds
-
getStalledTimeoutInSeconds
protected int getStalledTimeoutInSeconds()
- Specified by:
getStalledTimeoutInSeconds
in classCacheInitializer
-
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 classCacheInitializer
-
-