|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dream.AbstractComponent
org.objectweb.dream.synchro.MutexImpl
public class MutexImpl
Basic implementation of the Mutex
interface: this mutex is
non-reentrant. This implementation is unsafe, i.e. the identity of components
acquiring/releasing the Mutex is unknown. As a consequence, the acquired
mutex can be released by every component.
Note: inspired by Doug Lea's implementation.
Field Summary | |
---|---|
protected boolean |
inuse
The lock status. |
Fields inherited from class org.objectweb.dream.AbstractComponent |
---|
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC |
Fields inherited from interface org.objectweb.dream.synchro.Mutex |
---|
ITF_NAME |
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
---|
STARTED, STOPPED |
Constructor Summary | |
---|---|
MutexImpl()
|
Method Summary | |
---|---|
String[] |
listFc()
|
void |
lock()
Acquires the mutex. |
boolean |
timedLock(long msecs)
Tries to acquire the mutex. |
void |
unlock()
Releases the mutex. |
Methods inherited from class org.objectweb.dream.AbstractComponent |
---|
beforeFirstStart, bindFc, 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 |
Field Detail |
---|
protected boolean inuse
Constructor Detail |
---|
public MutexImpl()
Method Detail |
---|
public void lock() throws InterruptedException
Mutex
lock
in interface Mutex
InterruptedException
- the thread is interrupted.Mutex.lock()
public boolean timedLock(long msecs) throws InterruptedException
Mutex
timedLock
in interface Mutex
msecs
- the number of milliseconds to wait for the lock.
true
if the lock is acquired, false
otherwise.
InterruptedException
- if the thread is interrupted.Mutex.timedLock(long)
public void unlock()
Mutex
unlock
in interface Mutex
Mutex.unlock()
public String[] listFc()
listFc
in interface BindingController
BindingController.listFc()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |