org.apache.avalon.excalibur.concurrent
Class ReadWriteLock

java.lang.Object
  |
  +--org.apache.avalon.excalibur.concurrent.ReadWriteLock

Deprecated. use EDU.oswego.cs.dl.util.concurrent.ReadWriteLock instead

public class ReadWriteLock
extends Object

Class implementing a read/write lock. The lock has three states - unlocked, locked for reading and locked for writing. If the lock is unlocked, anyone can acquire a read or write lock. If the lock is locked for reading, anyone can acquire a read lock, but no one can acquire a write lock. If the lock is locked for writing, no one can quire any type of lock.

When the lock is released, those threads attempting to acquire a write lock will take priority over those trying to get a read lock.

Since:
4.0
Version:
CVS $Revision: 1.8 $ $Date: 2003/04/05 19:39:33 $
Author:
Leo Sutic

Constructor Summary
ReadWriteLock()
          Deprecated. Default constructor.
 
Method Summary
 void acquireRead()
          Deprecated. Attempts to acquire a read lock.
 void acquireWrite()
          Deprecated. Attempts to acquire a write lock.
 void aquireRead()
          Deprecated. It's spelled acquire...
 void aquireWrite()
          Deprecated. It's spelled acquire...
protected  int getNumReadLocksHeld()
          Deprecated. Returns the number of read locks held.
protected  int getNumWaitingForWrite()
          Deprecated. Returns the number of write locks held.
 void release()
          Deprecated. Releases a lock.
 boolean tryAcquireRead()
          Deprecated. Attempts to acquire a read lock.
 boolean tryAcquireWrite()
          Deprecated. Attempts to acquire a write lock.
 boolean tryAquireRead()
          Deprecated. It's spelled acquire...
 boolean tryAquireWrite()
          Deprecated. It's spelled acquire...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadWriteLock

public ReadWriteLock()
Deprecated. 
Default constructor.

Method Detail

acquireRead

public void acquireRead()
                 throws InterruptedException
Deprecated. 
Attempts to acquire a read lock. If no lock could be acquired the thread will wait until it can be obtained.

Throws:
InterruptedException - if the thread is interrupted while waiting for a lock.

aquireRead

public void aquireRead()
                throws InterruptedException
Deprecated. It's spelled acquire...

Throws:
InterruptedException - if the thread is interrupted while waiting for a lock.

acquireWrite

public void acquireWrite()
                  throws InterruptedException
Deprecated. 
Attempts to acquire a write lock. If no lock could be acquired the thread will wait until it can be obtained.

Throws:
InterruptedException - if the thread is interrupted while waiting for a lock.

aquireWrite

public void aquireWrite()
                 throws InterruptedException
Deprecated. It's spelled acquire...

Throws:
InterruptedException - if the thread is interrupted while waiting for a lock.

release

public void release()
Deprecated. 
Releases a lock. This method will release both types of locks.

Throws:
IllegalStateException - when an attempt is made to release an unlocked lock.

tryAcquireRead

public boolean tryAcquireRead()
Deprecated. 
Attempts to acquire a read lock. This method returns immediately.

Returns:
true iff the lock was successfully obtained.

tryAquireRead

public boolean tryAquireRead()
Deprecated. It's spelled acquire...

Returns:
true iff the lock was successfully obtained.

tryAcquireWrite

public boolean tryAcquireWrite()
Deprecated. 
Attempts to acquire a write lock. This method returns immediately.

Returns:
true iff the lock was successfully obtained.

tryAquireWrite

public boolean tryAquireWrite()
Deprecated. It's spelled acquire...

Returns:
true iff the lock was successfully obtained.

getNumReadLocksHeld

protected int getNumReadLocksHeld()
Deprecated. 
Returns the number of read locks held.


getNumWaitingForWrite

protected int getNumWaitingForWrite()
Deprecated. 
Returns the number of write locks held.



Copyright © 2000-2003 Apache Jakarta Project. All Rights Reserved.