|
GigaSpaces XAP 10.0.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.core.map.LockManager
public class LockManager
The lock manager is built on top of IMap
and supports the ability to lock and unlock
certain keys within the map.
Field Summary | |
---|---|
static Object |
EMPTY_LOCK_VALUE
A empty lock value written to indicate a lock when there is no value to lock on (i.e. calling lock on a key where there is no value in the cache). |
Constructor Summary | |
---|---|
LockManager(IMap map)
Creates a new Lock Manager based on the IMap . |
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object EMPTY_LOCK_VALUE
Constructor Detail |
---|
public LockManager(IMap map)
IMap
.
Method Detail |
---|
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 lock
public 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 unlock
|
GigaSpaces XAP 10.0.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |