Package org.keycloak.utils
Class LockObjectsForModification
- java.lang.Object
-
- org.keycloak.utils.LockObjectsForModification
-
public class LockObjectsForModification extends Object
This flags the session that all information loaded from the stores should be locked as the service layer plans to modify it. This is just a hint to the underlying storage, and a store might choose to ignore it. The lock for any object retrieved from the session will be kept until the end of the transaction. If the store supports it, this could prevent exceptions due to optimistic locking problems later in the processing. If the caller retrieved objects without this wrapper, they would still be able to modify those objects, and those changes would be written to the store at the end of the transaction at the lastet, but they won't be locked.- Author:
- Alexander Schwartz
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LockObjectsForModification.CallableWithoutThrowingAnException<V>
static class
LockObjectsForModification.Enabled
-
Constructor Summary
Constructors Constructor Description LockObjectsForModification()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isEnabled(KeycloakSession session, Class<?> model)
static <V> V
lockRealmsForModification(KeycloakSession session, LockObjectsForModification.CallableWithoutThrowingAnException<V> callable)
static <V> V
lockUserSessionsForModification(KeycloakSession session, LockObjectsForModification.CallableWithoutThrowingAnException<V> callable)
-
-
-
Method Detail
-
isEnabled
public static boolean isEnabled(KeycloakSession session, Class<?> model)
-
lockUserSessionsForModification
public static <V> V lockUserSessionsForModification(KeycloakSession session, LockObjectsForModification.CallableWithoutThrowingAnException<V> callable)
-
lockRealmsForModification
public static <V> V lockRealmsForModification(KeycloakSession session, LockObjectsForModification.CallableWithoutThrowingAnException<V> callable)
-
-