Interface IRWOLockManager<OBJECT,CONTEXT>
- All Superinterfaces:
IRWLockManager<OBJECT,
CONTEXT>
- All Known Implementing Classes:
RWOLockManager
A
read/write lock manager
that supports write option
locks.- Since:
- 3.2
- Author:
- Caspar De Groot
- No Implement
- This interface is not intended to be implemented by clients.
- No Extend
- This interface is not intended to be extended by clients.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.concurrent.IRWLockManager
IRWLockManager.LockType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final IRWLockManager.LockType
static final int
static final Collection<?>
static final long
Fields inherited from interface org.eclipse.net4j.util.concurrent.IRWLockManager
NO_WAIT, WAIT
-
Method Summary
Modifier and TypeMethodDescriptionlong
long
lock
(CONTEXT context, Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, long timeout, IRWOLockManager.LockDeltaHandler<OBJECT, CONTEXT> deltaHandler, Consumer<RWOLockManager.LockState<OBJECT, CONTEXT>> stateHandler) Adds locks of the given lockType, owned by the given context to the given objects.void
lock
(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) Deprecated.void
lock
(IRWLockManager.LockType lockType, CONTEXT context, OBJECT objectToLock, long timeout) Deprecated.lock2
(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) Deprecated.void
Deprecated.long
unlock
(CONTEXT context, Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, IRWOLockManager.LockDeltaHandler<OBJECT, CONTEXT> deltaHandler, Consumer<RWOLockManager.LockState<OBJECT, CONTEXT>> stateHandler) Removes locks of the given lockType, owned by the given context from the given objects.void
unlock
(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Deprecated.Deprecated.unlock2
(CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Deprecated.unlock2
(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Deprecated.Methods inherited from interface org.eclipse.net4j.util.concurrent.IRWLockManager
hasLock, hasLockByOthers
-
Field Details
-
ALL_OBJECTS
- Since:
- 3.16
-
ALL_LOCK_TYPES
- Since:
- 3.16
-
ALL_LOCKS
static final int ALL_LOCKS- Since:
- 3.16
- See Also:
-
NO_TIMEOUT
static final long NO_TIMEOUT- Since:
- 3.16
- See Also:
-
-
Method Details
-
getModCount
long getModCount()- Since:
- 3.16
-
lock
long lock(CONTEXT context, Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, long timeout, IRWOLockManager.LockDeltaHandler<OBJECT, CONTEXT> deltaHandler, Consumer<RWOLockManager.LockState<OBJECT, throws InterruptedException, TimeoutRuntimeExceptionCONTEXT>> stateHandler) Adds locks of the given lockType, owned by the given context to the given objects.- Parameters:
context
- The lock context to add from theobjects
. Must not benull
.objects
- The objects to lock. Must not benull
.lockType
- The type of lock to add to theobjects
. Must not benull
.count
- The number of locks to add to each of theobjects
.timeout
- The period in milliseconds after that aTimeoutRuntimeException
is thrown if some or all of theobjects
could not be locked, orNO_TIMEOUT
to attempt forever to acquire the requested locks.deltaHandler
- A handler that is notified with each delta in alock state
, ornull
if no such notification is needed. The handler is notified at most once per delta, but it can happen that the handler is notified before the lock operation finally fails with one of the specified exceptions. The notification handling should be fast because notifications occur while the calling thread is synchronized on this lock manager.stateHandler
- A handler that is notified with each newlock state
, ornull
if no such notification is needed.. The handler is notified at most once per lock state, but it can happen that the handler is notified before the lock operation finally fails with one of the specified exceptions. The notification handling should be fast because notifications occur while the calling thread is synchronized on this lock manager.- Returns:
- The new
modification count
. - Throws:
InterruptedException
- If the calling thread is interrupted.TimeoutRuntimeException
- If the timeout period has expired and some or all of theobjects
could not be locked.- Since:
- 3.16
-
unlock
long unlock(CONTEXT context, Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, IRWOLockManager.LockDeltaHandler<OBJECT, CONTEXT> deltaHandler, Consumer<RWOLockManager.LockState<OBJECT, CONTEXT>> stateHandler) Removes locks of the given lockType, owned by the given context from the given objects.- Parameters:
context
- The lock context to remove from theobjects
. Must not benull
.objects
- The objects to unlock, orALL_OBJECTS
to unlock all objects of thecontext
.lockType
- The type of lock to remove from theobjects
, orALL_LOCK_TYPES
to remove the locks of all types.count
- The number of locks to remove from each of theobjects
, orALL_LOCKS
to remove all locks.deltaHandler
- A handler that is notified with each delta in aRWOLockManager.LockState
, ornull
if no such notification is needed.stateHandler
- A handler that is notified with each newRWOLockManager.LockState
, ornull
if no such notification is needed.- Since:
- 3.16
-
lock2
@Deprecated List<RWOLockManager.LockState<OBJECT,CONTEXT>> lock2(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException Deprecated.- Throws:
InterruptedException
-
unlock2
@Deprecated List<RWOLockManager.LockState<OBJECT,CONTEXT>> unlock2(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Deprecated. -
unlock2
@Deprecated List<RWOLockManager.LockState<OBJECT,CONTEXT>> unlock2(CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Deprecated. -
unlock2
Deprecated. -
lock
@Deprecated void lock(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException Deprecated.- Specified by:
lock
in interfaceIRWLockManager<OBJECT,
CONTEXT> - Throws:
InterruptedException
-
lock
@Deprecated void lock(IRWLockManager.LockType lockType, CONTEXT context, OBJECT objectToLock, long timeout) throws InterruptedException Deprecated.- Specified by:
lock
in interfaceIRWLockManager<OBJECT,
CONTEXT> - Throws:
InterruptedException
-
unlock
@Deprecated void unlock(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) Deprecated.Description copied from interface:IRWLockManager
Attempts to release for a given lock type, context and objects.- Specified by:
unlock
in interfaceIRWLockManager<OBJECT,
CONTEXT>
-
unlock
Deprecated.Description copied from interface:IRWLockManager
Attempts to release all locks(read and write) for a given context.- Specified by:
unlock
in interfaceIRWLockManager<OBJECT,
CONTEXT>
-