Package org.keycloak.models.dblock
Interface DBLockProvider
- 
- All Superinterfaces:
- Provider
 - All Known Implementing Classes:
- LiquibaseDBLockProvider
 
 public interface DBLockProvider extends Provider 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). - Author:
- Marek Posolda
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classDBLockProvider.NamespaceLock namespace to have different lock types or contexts.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddestroyLockInfo()Will destroy whole state of DB lock (drop table/collection to track locking).DBLockProvider.NamespacegetCurrentLock()Returns the current provider namespace locked or nullvoidreleaseLock()Release previously acquired lock by this provider.booleansupportsForcedUnlock()voidwaitForLock(DBLockProvider.Namespace lock)Try to retrieve DB lock or wait if retrieve was unsuccessful.
 
- 
- 
- 
Method Detail- 
waitForLockvoid waitForLock(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.- Parameters:
- 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- Returns:
- The namespace locked or null if there is no lock
 
 - 
supportsForcedUnlockboolean supportsForcedUnlock() - Returns:
- true if provider supports forced unlock at startup
 
 - 
destroyLockInfovoid destroyLockInfo() Will destroy whole state of DB lock (drop table/collection to track locking).
 
- 
 
-