org.objectweb.dream.synchro
Class ConditionImpl
java.lang.Object
org.objectweb.dream.AbstractComponent
org.objectweb.dream.synchro.ConditionImpl
- All Implemented Interfaces:
- ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, Condition, BindingController, LifeCycleController
public class ConditionImpl
- extends AbstractComponent
- implements Condition
Basic implementation of the Condition
interface. This implementation
uses a non-renetrant mutex.
Note: Inspired by Doug Lea's implementation.
Methods inherited from class org.objectweb.dream.AbstractComponent |
beforeFirstStart, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mutexItf
protected Mutex mutexItf
ConditionImpl
public ConditionImpl()
await
public void await()
throws InterruptedException
- Description copied from interface:
Condition
- Wait for notification. This operation at least momentarily releases the
mutex. The mutex is always held upon return, even if interrupted.
- Specified by:
await
in interface Condition
- Throws:
InterruptedException
- if the thread was interrupted before or
during the wait. However, if the thread is interrupted after
the wait but during mutex re-acquisition, the interruption is
ignored, while still ensuring that the currentThread's
interruption state stays true, so can be probed by callers.- See Also:
Condition.await()
timedwait
public boolean timedwait(long msecs)
throws InterruptedException
- Description copied from interface:
Condition
- Wait for at most msecs for notification. This operation at least
momentarily releases the mutex. The mutex is always held upon return, even
if interrupted.
- Specified by:
timedwait
in interface Condition
- Parameters:
msecs
- The time to wait. A value less than or equal to zero causes a
momentarily release and re-acquire of the mutex, and always
returns false.
- Returns:
- false if at least msecs have elapsed upon resumption; else true. A
false return does NOT necessarily imply that the thread was not
notified. For example, it might have been notified after the time
elapsed but just before resuming.
- Throws:
InterruptedException
- if the thread was interrupted before or
during the wait.- See Also:
Condition.timedwait(long)
signal
public void signal()
- Description copied from interface:
Condition
- Notify a waiting thread. If one exists, a non-interrupted thread will
return normally (i.e., not via InterruptedException) from await or
timedwait.
- Specified by:
signal
in interface Condition
- See Also:
Condition.signal()
signalAll
public void signalAll()
- Description copied from interface:
Condition
- Notify all waiting threads *
- Specified by:
signalAll
in interface Condition
- See Also:
Condition.signalAll()
bindFc
public void bindFc(String clientItfName,
Object serverItf)
throws NoSuchInterfaceException,
IllegalBindingException,
IllegalLifeCycleException
- Specified by:
bindFc
in interface BindingController
- Overrides:
bindFc
in class AbstractComponent
- Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
- See Also:
BindingController.bindFc(java.lang.String,
java.lang.Object)
listFc
public String[] listFc()
- Specified by:
listFc
in interface BindingController
- See Also:
BindingController.listFc()
Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.