|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ITransactionLock
Common interface for locks in transactionable editing domains.
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. |
Method Detail |
---|
Thread getOwner()
null
if I am availableint getDepth()
void acquire(boolean exclusive) throws InterruptedException
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.
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 threadboolean acquire(long timeout, boolean exclusive) throws InterruptedException
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.
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
IllegalArgumentException
- if timeout
is negative
InterruptedException
- on interruption of the calling threadvoid uiSafeAcquire(boolean exclusive) throws InterruptedException
If this method is called from a thread that is running as a Job, then
it behaves identically to 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.
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 threadvoid release()
IllegalStateException
- if the calling thread does not own meboolean yield()
true
, then the caller must actually
release
me before another thread can take me. It then resumes by acquiring me
again, layer.
true
if the lock was successfully yielded to another
thread; false
, otherwisevoid checkedTransfer(Thread thread)
|
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 |