|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.transaction.util.EmptyLock
public final class EmptyLock
A lock which does not provide any mutual exclusion. This implementation is needed for rudimentary standalone scenario support.
Constructor Summary | |
---|---|
EmptyLock()
|
Method Summary | |
---|---|
void |
acquire(boolean exclusive)
Acquires me, waiting as long as necessary or until I am interrupted. |
boolean |
acquire(long timeout,
boolean exclusive)
Attempts to acquire me, timing out after the specified number of millis. |
void |
checkedTransfer(Thread thread)
|
int |
getDepth()
Queries the depth to which I am acquired by the calling thread. |
Thread |
getOwner()
Queries the current owner of the lock. |
void |
release()
Releases me. |
void |
uiSafeAcquire(boolean exclusive)
Attempts to acquire me (without a timeout) in a manner that is safe to execute on the UI thread. |
boolean |
yield()
Temporarily yields the lock to another thread that does not require exclusive access, if any such thread exists. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EmptyLock()
Method Detail |
---|
public void acquire(boolean exclusive) throws InterruptedException
ITransactionLock
ITransactionLock.release()
for me to make.
Note: The current thread must not own my monitor when it calls this method, otherwise it will cause deadlock. Deadlock would be guaranteed because every thread waits on a different object that is not me, so my monitor is not released when the calling thread blocks.
acquire
in interface ITransactionLock
exclusive
- true
if the current thread needs exclusive
access (i.e., no other threads may currently be
yielding
me); false
, otherwise
InterruptedException
- on interruption of the calling threadpublic boolean acquire(long timeout, boolean exclusive) throws InterruptedException
ITransactionLock
Note: The current thread must not own my monitor when it calls this method, otherwise it will cause deadlock. Deadlock would be guaranteed because every thread waits on a different object that is not me, so my monitor is not released when the calling thread blocks.
acquire
in interface ITransactionLock
timeout
- the number of milliseconds to wait before giving up on
the lock, or 0
to wait as long as necessaryexclusive
- true
if the current thread needs exclusive
access (i.e., no other threads may currently be
yielding
me); false
, otherwise
true
if the caller successfully acquired me;
false
if it did not within the timeout
InterruptedException
- on interruption of the calling threadpublic void checkedTransfer(Thread thread)
checkedTransfer
in interface ITransactionLock
public int getDepth()
ITransactionLock
getDepth
in interface ITransactionLock
public Thread getOwner()
ITransactionLock
getOwner
in interface ITransactionLock
null
if I am availablepublic void release()
ITransactionLock
release
in interface ITransactionLock
public void uiSafeAcquire(boolean exclusive) throws InterruptedException
ITransactionLock
If this method is called from a thread that is running as a Job, then
it behaves identically to ITransactionLock.acquire(boolean)
.
Note: The current thread must not own my monitor when it calls this method, otherwise it will cause deadlock. Deadlock would be guaranteed because every thread waits on a different object that is not me, so my monitor is not released when the calling thread blocks.
uiSafeAcquire
in interface ITransactionLock
exclusive
- true
if the current thread needs exclusive
access (i.e., no other threads may currently be
yielding
me); false
, otherwise
InterruptedException
- in case of interrupt while waiting
or if the user cancels the lock-acquisition job that is blocking
the UI threadpublic boolean yield()
ITransactionLock
true
, then the caller must actually
release
me before another thread can take me. It then resumes by acquiring me
again, layer.
yield
in interface ITransactionLock
true
if the lock was successfully yielded to another
thread; false
, otherwise
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |