|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Lock
Field Summary | |
---|---|
static int |
NO_LOCK
|
static int |
READ_LOCK
|
static int |
WRITE_LOCK
|
Method Summary | |
---|---|
boolean |
acquire()
Acquire a lock for read. |
boolean |
acquire(int mode)
Acquire a lock for read or write. |
boolean |
attempt(int mode)
Attempt to acquire a lock for read or write. |
String |
getId()
|
LockInfo |
getLockInfo()
Create a LockInfo entry for the given lock. |
boolean |
hasLock()
Check if the lock is currently locked by someone. |
boolean |
hasLock(Thread owner)
Check if the specified thread holds either a write or a read lock on the resource. |
boolean |
isLockedForRead(Thread owner)
Check if the specified thread does currently hold a read lock. |
boolean |
isLockedForWrite()
Returns true if there are active or pending write locks. |
void |
release(int mode)
Release a lock of the specified type. |
void |
release(int mode,
int count)
|
void |
wakeUp()
Wake up waiting threads and recompute dependencies. |
Field Detail |
---|
static final int READ_LOCK
static final int WRITE_LOCK
static final int NO_LOCK
Method Detail |
---|
boolean acquire() throws LockException
LockException
boolean acquire(int mode) throws LockException
READ_LOCK
or
WRITE_LOCK
.
mode
-
LockException
boolean attempt(int mode)
mode
- void release(int mode)
mode
- void release(int mode, int count)
boolean isLockedForWrite()
boolean isLockedForRead(Thread owner)
owner
- the thread to search for
boolean hasLock()
boolean hasLock(Thread owner)
owner
- the thread
void wakeUp()
String getId()
LockInfo getLockInfo()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |