org.apache.avalon.excalibur.concurrent
Class ConditionalEvent

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

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

public class ConditionalEvent
extends Object

This class implements a POSIX style "Event" object. The difference between the ConditionalEvent and the java wait()/notify() technique is in handling of event state. If a ConditionalEvent is signalled, a thread that subsequently waits on it is immediately released. In case of auto reset EventObjects, the object resets (unsignalled) itself as soon as it is signalled and waiting thread(s) are released (based on whether signal() or signalAll() was called).

Since:
4.0
Version:
CVS $Revision: 1.4 $ $Date: 2003/03/22 12:46:23 $
Author:
Karthik Rangaraju

Constructor Summary
ConditionalEvent(boolean initialState)
          Deprecated. Creates a manual reset ConditionalEvent with a specified initial state
ConditionalEvent(boolean initialState, boolean autoReset)
          Deprecated. Creates a ConditionalEvent with the defined initial state.
 
Method Summary
 boolean isSignalled()
          Deprecated. Checks if the event is signalled.
 void reset()
          Deprecated. Resets the event to an unsignalled state
 void signal()
          Deprecated. Signals the event.
 void signalAll()
          Deprecated. Current implementation only works with manual reset events.
 void waitForSignal()
          Deprecated. If the event is signalled, this method returns immediately resetting the signal, otherwise it blocks until the event is signalled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionalEvent

public ConditionalEvent(boolean initialState)
Deprecated. 
Creates a manual reset ConditionalEvent with a specified initial state

Parameters:
initialState - Sets the initial state of the ConditionalEvent. Signalled if pInitialState is true, unsignalled otherwise.

ConditionalEvent

public ConditionalEvent(boolean initialState,
                        boolean autoReset)
Deprecated. 
Creates a ConditionalEvent with the defined initial state.

Parameters:
initialState - if true, the ConditionalEvent is signalled when created.
autoReset - if true creates an auto-reset ConditionalEvent
Method Detail

isSignalled

public boolean isSignalled()
Deprecated. 
Checks if the event is signalled. Does not block on the operation.

Returns:
true is event is signalled, false otherwise. Does not reset an autoreset event

signal

public void signal()
Deprecated. 
Signals the event. A single thread blocked on waitForSignal() is released.

See Also:
signalAll(), waitForSignal()

signalAll

public void signalAll()
Deprecated. 
Current implementation only works with manual reset events. Releases. all threads blocked on waitForSignal()

See Also:
waitForSignal()

reset

public void reset()
Deprecated. 
Resets the event to an unsignalled state


waitForSignal

public void waitForSignal()
                   throws InterruptedException
Deprecated. 
If the event is signalled, this method returns immediately resetting the signal, otherwise it blocks until the event is signalled.

Throws:
InterruptedException - if the thread is interrupted when blocked


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