Nested Class Summary
Method SummaryModifier and TypeMethodDescription
voidReleases all locks acquired by this GlobalLockProvider.
<V> VAcquires a new non-reentrant global lock that is visible to all Keycloak nodes.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withLockpublic <V> V withLock
(String lockName, Duration timeToWaitForLock, KeycloakSessionTaskWithResult<V> task)Acquires a new non-reentrant global lock that is visible to all Keycloak nodes. If the lock was successfully acquired the method runs the
taskand return result to the caller. See
GlobalLockProvider.withLock(String, Duration, KeycloakSessionTaskWithResult)for more details. This implementation does NOT meet all requirements from the JavaDoc of
GlobalLockProvider.withLock(String, Duration, KeycloakSessionTaskWithResult)because
DBLockProviderdoes not provide a way to lock and unlock in separate transactions. Also, the database schema update currently requires to be running in the same thread that initiated the update therefore the
taskis also running in the caller thread/transaction.
- Specified by:
- Type Parameters:
V- Type of object returned by the
lockName- Identifier used for acquiring lock. Can be any non-null string.
timeToWaitForLock- Duration this method waits until it gives up acquiring the lock. If
null, each implementation should provide some default duration, for example, using a configuration option.
task- The task that will be executed under the acquired lock
- Value returned by the
forceReleaseAllLockspublic void forceReleaseAllLocks()Description copied from interface:
GlobalLockProviderReleases all locks acquired by this GlobalLockProvider. This method unlocks all existing locks acquired by this provider regardless of the thread or Keycloak instance that originally acquired them.
closepublic void close()