|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.emory.mathcs.util.remote.locks.ReentrantDistributedLock
Implements a reentrant lock on top of a possibly non-reentrant remote lock
so that local threads are scheduled within the JVM instead of competing
for a remote resource. Depends on a correctly implemented semantics of
equals for the remote lock (see RemoteLock
).
Constructor Summary | |
ReentrantDistributedLock(RemoteLock remoteLock)
Create a new ReentrantRemoteLock instance. |
Method Summary | |
boolean |
equals(java.lang.Object other)
|
int |
hashCode()
|
void |
lock()
Acquires the remote lock. If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired. |
void |
lockInterruptibly()
Acquires the remote lock unless the current thread is interrupted. If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
|
RemoteCondition |
newCondition()
Returns a new Condition instance that is bound to this RemoteLock instance. |
boolean |
tryLock()
Acquires the remote lock only if it is free at the time of invocation. If the lock is not available then this method will return immediately with the value false. |
boolean |
tryLock(long timeout,
TimeUnit unit)
Acquires the remote lock if it is free within the given waiting time and the current thread has not been interrupted. If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
|
void |
unlock()
Releases the remote lock. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReentrantDistributedLock(RemoteLock remoteLock)
Method Detail |
public void lock() throws java.rmi.RemoteException
lock
in interface RemoteLock
java.rmi.RemoteException
- if a communication error occurspublic boolean tryLock() throws java.rmi.RemoteException
tryLock
in interface RemoteLock
java.rmi.RemoteException
- if a communication error occurspublic void lockInterruptibly() throws java.lang.InterruptedException, java.rmi.RemoteException
lockInterruptibly
in interface RemoteLock
java.rmi.RemoteException
- if a communication error occurs
java.lang.InterruptedException
- if the current thread is interrupted
while acquiring the lock (and interruption of lock acquisition is
supported).public boolean tryLock(long timeout, TimeUnit unit) throws java.lang.InterruptedException, java.rmi.RemoteException
tryLock
in interface RemoteLock
timeout
- the maximum time to wait for the lockunit
- the time unit of the time argument.
java.rmi.RemoteException
- if a communication error occurs
java.lang.InterruptedException
- if the current thread is interrupted
while acquiring the lock (and interruption of lock acquisition is
supported).public void unlock() throws java.rmi.RemoteException
unlock
in interface RemoteLock
java.rmi.RemoteException
- if a communication error occurspublic RemoteCondition newCondition() throws java.rmi.RemoteException
RemoteLock
newCondition
in interface RemoteLock
java.rmi.RemoteException
public int hashCode()
public boolean equals(java.lang.Object other)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |