org.iids.aos.util
Class Mutex

java.lang.Object
  extended by org.iids.aos.util.Mutex

public class Mutex
extends java.lang.Object

Utility class: mutex


Constructor Summary
Mutex()
          Constructs a new Mutex object.
 
Method Summary
 void acquire()
          Acquire the lock.
 boolean locked()
          Returns true if this mutex has been been locked.
 void release()
          Release the lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mutex

public Mutex()
Constructs a new Mutex object.

Method Detail

acquire

public void acquire()
             throws java.lang.InterruptedException
Acquire the lock. This method blocks until the lock is acquired. The method is interruptible. The lock is NOT re-entrant, that is, you cannot acquire the lock twice, not even the same thread.

Throws:
java.lang.InterruptedException - The lock has not been acquired.

release

public void release()
Release the lock. This method releases the lock and wakes up a thread waiting to acquire the lock. The order in which the lock-requests will be granted is unspecified. The caller must have acquired the lock before.


locked

public boolean locked()
Returns true if this mutex has been been locked.

Returns:
true if mutex has been locked.


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.