|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Lock represents a lock that can be acquired in several modes.
| Method Summary | |
java.lang.String |
acquire(Locker locker,
java.lang.String mode)
Acquires lock. |
java.lang.String |
checkAcquire(Locker locker,
java.lang.String mode)
Check whether lock can be acquired. |
java.lang.String[] |
getModes()
Gets lock modes. |
boolean |
isAcquired(Locker locker)
Tests if a lock has been acquired by the given locker. |
boolean |
isAcquired(Locker locker,
java.lang.String mode)
Tests if a lock of the given mode has been acquired by the given locker. |
void |
release(Locker locker)
Releases lock. |
| Method Detail |
public java.lang.String[] getModes()
public java.lang.String acquire(Locker locker,
java.lang.String mode)
throws LockConflictException
Locker in the given mode. If the lock has been acquired
before by another Locker in a conflicting mode, then
the current thread is suspended and waits for the lock release. The method
finishes when the lock is not acquired by a conflicting mode by another
Locker and lock can be acquired by the given Locker
Locker before, the
existing lock mode is converted to a new one, which is supremum of
the existing mode and the requested one according to the lock conversion
table.
locker - an entity in name of which the lock is lockedmode - requested lock mode
LockConflictException - if there is conflict between the current
lock mode acquired by the locker and the requested mode
(the supremum mode does not exist)LockConversionTable
public boolean isAcquired(Locker locker,
java.lang.String mode)
locker - an entity in name of which the lock is lockedmode - requested lock mode
public boolean isAcquired(Locker locker)
locker - an entity in name of which the lock is locked
public java.lang.String checkAcquire(Locker locker,
java.lang.String mode)
throws LockConflictException
acquire(org.objectweb.jotm.core.conflict.Locker, java.lang.String) method, but the lock is not acquired and the current
thread is never suspended due to the lock acquired by another locker.
locker - an entity in name of which the lock is lockedmode - requested lock mode
null
if the lock has been acquired by another locker in a
conflicting mode (i.e., null signalizes that
the current thread would be suspended if the given locker
will acquire the lock in the given mode.
LockConflictException - if there is conflict between the current
lock mode acquired by the locker and the requested mode
(the supremum mode does not exist)acquire(org.objectweb.jotm.core.conflict.Locker, java.lang.String),
LockConversionTable
public void release(Locker locker)
throws NoSuchLockException
locker - an entity in name of which the lock is locked
NoSuchLockException - if there is no lock hold by the given locker
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||