Class HotRodLocksUtils
- java.lang.Object
- 
- org.keycloak.models.map.storage.hotRod.locking.HotRodLocksUtils
 
- 
 public class HotRodLocksUtils extends Object 
- 
- 
Constructor SummaryConstructors Constructor Description HotRodLocksUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanremoveWithInstanceIdentifier(ConcurrentMap<String,String> map, String lockName)Removes the entry with keylockNamefrom map if the value of the entry is equal to this node's identifierstatic voidrepeatPutIfAbsent(org.infinispan.client.hotrod.RemoteCache<String,String> locksCache, String lockName, Duration timeout, int repeatInterval, boolean isReentrant)Repeatedly attempts to put an entry with the keylockNameto thelocksCache.
 
- 
- 
- 
Field Detail- 
SEPARATORpublic static final String SEPARATOR - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
repeatPutIfAbsentpublic static void repeatPutIfAbsent(org.infinispan.client.hotrod.RemoteCache<String,String> locksCache, String lockName, Duration timeout, int repeatInterval, boolean isReentrant) throws LockAcquiringTimeoutException Repeatedly attempts to put an entry with the keylockNameto thelocksCache. Succeeds only if there is no entry with the same key already. The value of created entry is equal to instance identifier. It is possible to make the method succeed even if the value already exists with the same instance identifier. This behaviour is enabled usingisReentrantswitch. Execution of this method is time bounded, if this method does not succeed withintimeoutMillisecondsit gives up and returns false. There is a pause after each unsuccessful attempt equal torepeatIntervalmilliseconds- Parameters:
- locksCache- Cache that will be used for putting the value
- lockName- Name of the entry
- timeout- duration to wait until the lock is acquired
- repeatInterval- Number of milliseconds to wait after each unsuccessful attempt
- isReentrant- if this is set to true, the method succeeds also when the value for given key is equal to the instance identifier
- Throws:
- LockAcquiringTimeoutException- the key- lockNamewas NOT put into the- mapwithin time boundaries
- IllegalStateException- when a- lockvalue found in the storage has wrong format. It is expected the lock value has the following format- 'timeAcquired;keycloakInstanceIdentifier'
 
 - 
removeWithInstanceIdentifierpublic static boolean removeWithInstanceIdentifier(ConcurrentMap<String,String> map, String lockName) Removes the entry with keylockNamefrom map if the value of the entry is equal to this node's identifier- Parameters:
- map- Map that will be used for removing
- lockName- Name of the entry
- Returns:
- true if the entry was removed, false otherwise
 
 
- 
 
-