|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface mirroring the Lock interface in java.util.concurrent but allowing for RemoteExceptions since an implementation will involve network communication. Semantics of equals: two remote locks should be considered equal w.r.t. the equals() method iff they represent the same remote lock, i.e. method calls on each of them must perform the same actions. In particular, it must be possible to call lock() on one of the objects and successful unlock() on the other.
Method Summary | |
void |
lock()
Acquires the remote lock. |
void |
lockInterruptibly()
Acquires the remote lock unless the current thread is interrupted. |
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. |
boolean |
tryLock(long time,
TimeUnit unit)
Acquires the remote lock if it is free within the given waiting time and the current thread has not been interrupted. |
void |
unlock()
Releases the remote lock. |
Method Detail |
public void lock() throws java.rmi.RemoteException
java.rmi.RemoteException
- if a communication error occurspublic void lockInterruptibly() throws java.lang.InterruptedException, java.rmi.RemoteException
java.lang.InterruptedException
- if the current thread is interrupted
while acquiring the lock (and interruption of lock acquisition is
supported).
java.rmi.RemoteException
- if a communication error occurspublic boolean tryLock() throws java.rmi.RemoteException
java.rmi.RemoteException
- if a communication error occurspublic boolean tryLock(long time, TimeUnit unit) throws java.lang.InterruptedException, java.rmi.RemoteException
time
- the maximum time to wait for the lockunit
- the time unit of the time argument.
java.lang.InterruptedException
- if the current thread is interrupted
while acquiring the lock (and interruption of lock acquisition is
supported).
java.rmi.RemoteException
- if a communication error occurspublic void unlock() throws java.rmi.RemoteException
java.rmi.RemoteException
- if a communication error occurspublic RemoteCondition newCondition() throws java.rmi.RemoteException
java.rmi.RemoteException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |