Modifier and Type | Field and Description |
---|---|
static Object |
EMPTY_LOCK_VALUE
A empty lock value written to indicate a lock when there is no value to lock on (i.e.
|
Constructor and Description |
---|
LockManager(IMap map)
Creates a new Lock Manager based on the
IMap . |
Modifier and Type | Method and Description |
---|---|
static boolean |
isEmptyLockValue(Object value) |
boolean |
islocked(Object key)
Returns
true if the given key is locked. |
LockHandle |
lock(Object key,
long lockTimeToLive,
long timeoutWaitingForLock)
Locks the given key for any updates.
|
void |
putAndUnlock(Object key,
Object value)
Unlocks the given key and puts the given value in a single operation.
|
void |
unlock(Object key)
Unlocks the given lock on the key
|
public static final Object EMPTY_LOCK_VALUE
public static boolean isEmptyLockValue(Object value)
public LockHandle lock(Object key, long lockTimeToLive, long timeoutWaitingForLock)
LockHandle
that can be used to perform specific updates under the same lock (by using the transaction
object stored within it).
Might create an empty value if there is no value in order to lock on. The empty value can
be checked using isEmptyLockValue(Object)
.
key
- The key to locklockTimeToLive
- The lock time to live (in milliseconds)timeoutWaitingForLock
- The time to wait for an already locked lockpublic void putAndUnlock(Object key, Object value)
key
- The key to unlock and put the value invalue
- The value to put after unlocking the keypublic boolean islocked(Object key)
true
if the given key is locked. Otherwise returns false
.key
- The key to check if it locked or not.true
if the given key is locked or not.public void unlock(Object key)
key
- The key to unlockCopyright © GigaSpaces.