|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface providing a pessimistic lock mechanism to an instance of a resource. Access is controlled by shared and exclusive locks; multiple contexts can hold a shared lock at the same time, but only one may hold an exclusive lock at any time. Lock allocation policy is determined by the implementation and may or may not be fair.
Method Summary | |
void |
exclusiveLock(Object context)
Provide context with exclusive access to this resource. |
void |
release(Object context)
Notification from context that it no longer requires access to this resource |
void |
sharedLock(Object context)
Provide context with shared access to this resource. |
Method Detail |
public void sharedLock(Object context) throws InterruptedException
context
- the context requesting access
InterruptedException
- if the thread is interrupted before receiving the lockpublic void exclusiveLock(Object context) throws InterruptedException
context
- the context requesting access
InterruptedException
- if the thread is interrupted before receiving the lockpublic void release(Object context)
context
- the context relinguishing access
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |