Interface IRWLockManager<OBJECT,CONTEXT>
- All Known Subinterfaces:
IRWOLockManager<OBJECT,
CONTEXT>
- All Known Implementing Classes:
RWLockManager
,RWOLockManager
public interface IRWLockManager<OBJECT,CONTEXT>
Support Multiple reads/no write and upgrade lock from read to write. Many context could request
write
lock at the same time. It will privileges first context that has already a
read
lock. If no one has any read lock, it's "first come first serve".- Since:
- 3.0
- Author:
- Eike Stepper
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasLock
(IRWLockManager.LockType type, CONTEXT context, OBJECT objectToLock) boolean
hasLockByOthers
(IRWLockManager.LockType type, CONTEXT context, OBJECT objectToLock) void
lock
(IRWLockManager.LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) void
lock
(IRWLockManager.LockType type, CONTEXT context, OBJECT objectToLock, long timeout) void
Attempts to release all locks(read and write) for a given context.void
unlock
(IRWLockManager.LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Attempts to release for a given lock type, context and objects.
-
Field Details
-
WAIT
Deprecated.- See Also:
-
NO_WAIT
Deprecated.- See Also:
-
-
Method Details
-
lock
void lock(IRWLockManager.LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException - Throws:
InterruptedException
-
lock
void lock(IRWLockManager.LockType type, CONTEXT context, OBJECT objectToLock, long timeout) throws InterruptedException - Throws:
InterruptedException
-
unlock
void unlock(IRWLockManager.LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Attempts to release for a given lock type, context and objects.- Throws:
IllegalMonitorStateException
- Unlocking objects without lock.
-
unlock
Attempts to release all locks(read and write) for a given context. -
hasLock
-
hasLockByOthers
-