- All Superinterfaces:
- All Known Implementing Classes:
Global database lock to ensure that some actions in DB can be done just be one cluster node at a time.
There are different namespaces that can be locked. The same DBLockProvider (same session in keycloack) can only be used to lock one namespace, a second attempt will throw a RuntimeException. The hasLock method returns the local namespace locked by this provider.
Different DBLockProvider instances can be used to lock in different threads. Note that the DBLockProvider is associated to the session (so in order to have different lock providers different sessions are needed).
- Marek Posolda
Nested Class SummaryModifier and TypeInterfaceDescription
static enumLock namespace to have different lock types or contexts.
Method SummaryModifier and TypeMethodDescription
voidWill destroy whole state of DB lock (drop table/collection to track locking).Returns the current provider namespace locked or null
voidRelease previously acquired lock by this provider.
voidTry to retrieve DB lock or wait if retrieve was unsuccessful.
(DBLockProvider.Namespace lock)Try to retrieve DB lock or wait if retrieve was unsuccessful. Throw exception if lock can't be retrieved within specified timeout (900 seconds by default) Throw exception if a different namespace has already been locked by this provider.
lock- The namespace to lock
releaseLockvoid releaseLock()Release previously acquired lock by this provider.
getCurrentLockDBLockProvider.Namespace getCurrentLock()Returns the current provider namespace locked or null
- The namespace locked or null if there is no lock
- true if provider supports forced unlock at startup
destroyLockInfovoid destroyLockInfo()Will destroy whole state of DB lock (drop table/collection to track locking).