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).
Modifier and Type | Interface and Description |
---|---|
static class |
DBLockProvider.Namespace
Lock namespace to have different lock types or contexts.
|
Modifier and Type | Method and Description |
---|---|
void |
destroyLockInfo()
Will destroy whole state of DB lock (drop table/collection to track locking).
|
DBLockProvider.Namespace |
getCurrentLock()
Returns the current provider namespace locked or null
|
void |
releaseLock()
Release previously acquired lock by this provider.
|
boolean |
supportsForcedUnlock() |
void |
waitForLock(DBLockProvider.Namespace lock)
Try to retrieve DB lock or wait if retrieve was unsuccessful.
|
void waitForLock(DBLockProvider.Namespace lock)
lock
- The namespace to lockvoid releaseLock()
DBLockProvider.Namespace getCurrentLock()
boolean supportsForcedUnlock()
void destroyLockInfo()
Copyright © 2021 JBoss by Red Hat. All rights reserved.