|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.objectweb.jotm.impl.core.conflict.BasicLock
Basic Lock is a simple lock implementation.
| Constructor Summary | |
BasicLock(ConflictTable iTable)
|
|
| 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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BasicLock(ConflictTable iTable)
| Method Detail |
public java.lang.String[] getModes()
Lock
getModes in interface Lock
public java.lang.String acquire(Locker locker,
java.lang.String mode)
throws LockConflictException
LockLocker 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.
acquire in interface Locklocker - 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)
Lock
isAcquired in interface Locklocker - an entity in name of which the lock is lockedmode - requested lock mode
public boolean isAcquired(Locker locker)
Lock
isAcquired in interface Locklocker - an entity in name of which the lock is locked
public java.lang.String checkAcquire(Locker locker,
java.lang.String mode)
throws LockConflictException
LockLock.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.
checkAcquire in interface Locklocker - 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)Lock.acquire(org.objectweb.jotm.core.conflict.Locker, java.lang.String),
LockConversionTable
public void release(Locker locker)
throws NoSuchLockException
Lock
release in interface Locklocker - 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 | ||||||||||