Package org.keycloak.models.map.lock
Class MapGlobalLockProvider
java.lang.Object
org.keycloak.models.map.lock.MapGlobalLockProvider
- All Implemented Interfaces:
GlobalLockProvider,Provider
Implementing a
GlobalLockProvider based on a map storage.
This requires the map store to support the entity type MapLockEntity. One of the stores which supports
this is the JPA Map Store. The store needs to support the uniqueness of entries in the lock area, see
lock(String) for details.- Author:
- Alexander Schwartz
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.models.locking.GlobalLockProvider
GlobalLockProvider.Constants -
Constructor Summary
ConstructorsConstructorDescriptionMapGlobalLockProvider(KeycloakSession session, long defaultTimeoutMilliseconds, Supplier<MapStorage<MapLockEntity, MapLockEntity>> lockStoreSupplier) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()void<V> VwithLock(String lockName, Duration timeToWaitForLock, KeycloakSessionTaskWithResult<V> task) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.locking.GlobalLockProvider
withLock
-
Constructor Details
-
MapGlobalLockProvider
public MapGlobalLockProvider(KeycloakSession session, long defaultTimeoutMilliseconds, Supplier<MapStorage<MapLockEntity, MapLockEntity>> lockStoreSupplier)
-
-
Method Details
-
withLock
public <V> V withLock(String lockName, Duration timeToWaitForLock, KeycloakSessionTaskWithResult<V> task) throws LockAcquiringTimeoutException - Specified by:
withLockin interfaceGlobalLockProvider- Throws:
LockAcquiringTimeoutException
-
forceReleaseAllLocks
public void forceReleaseAllLocks()- Specified by:
forceReleaseAllLocksin interfaceGlobalLockProvider
-
close
public void close()
-