|
|||||||||
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.MutexReEntrantImpl
public class MutexReEntrantImpl
Basic implementation of the MutexReEntrant
interface: this mutex is
reentrant.
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.MutexReEntrant |
---|
ITF_NAME |
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
---|
STARTED, STOPPED |
Constructor Summary | |
---|---|
MutexReEntrantImpl()
|
Method Summary | |
---|---|
void |
forceLock(Object o)
Acquires the mutex with parameters that have been returned by a previous call to forceUnlock(). |
Object |
forceUnlock()
Releases the mutex even if it has been acquired several times (by multiple calls to the lock() function). |
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 MutexReEntrantImpl()
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 Object forceUnlock()
MutexReEntrant
forceUnlock
in interface MutexReEntrant
MutexReEntrant.forceUnlock()
public void forceLock(Object o) throws InterruptedException
MutexReEntrant
forceLock
in interface MutexReEntrant
o
- parameters that have been returned by a previous call to
forceUnlock().
InterruptedException
- the thread is interrupted.MutexReEntrant.forceLock(Object)
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 |