Class IRWOLockManager.LockChange<OBJECT>
java.lang.Object
org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange<OBJECT>
- Type Parameters:
OBJECT- the locked object type
- Enclosing interface:
IRWOLockManager<OBJECT,CONTEXT>
An immutable request to lock or unlock objects for one context. A
null object collection means all
objects owned by the context and is valid only for an IRWOLockManager.LockChange.Operation.UNLOCK change. For unlock changes, a
null lock type means all lock types and IRWOLockManager.ALL_LOCKS means all lock counts.- Since:
- 3.31
- Author:
- Eike Stepper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceReceives one effective delta from aIRWOLockManager.changeLocks(CONTEXT, java.util.List<? extends org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange<OBJECT>>, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange.DeltaHandler<OBJECT, CONTEXT>, java.util.function.Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<OBJECT, CONTEXT>>)call.static enumThe kind of mutation represented by aIRWOLockManager.LockChange. -
Constructor Summary
ConstructorsConstructorDescriptionLockChange(IRWOLockManager.LockChange.Operation operation, Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, long timeout) Creates one immutable lock mutation request. -
Method Summary
Modifier and TypeMethodDescriptionintgetCount()Returns the requested lock count.Returns the lock type, ornullto unlock all types.Collection<? extends OBJECT> Returns the immutable object collection, ornullfor all objects owned by the context.Returns the requested operation.longReturns the requested acquisition timeout.booleanisLock()Returns whether this request acquires locks.booleanisUnlock()Returns whether this request releases locks.static <OBJECT> IRWOLockManager.LockChange<OBJECT> lock(Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, long timeout) Creates a request to acquire a lock on each object in the given collection.static <OBJECT> IRWOLockManager.LockChange<OBJECT> unlock(Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count) Creates a request to release locks from the given objects.
-
Constructor Details
-
LockChange
public LockChange(IRWOLockManager.LockChange.Operation operation, Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, long timeout) Creates one immutable lock mutation request.- Parameters:
operation- whether to add or remove locksobjects- the objects, ornullfor all objects owned by the context on an unlocklockType- the lock type, ornullfor all lock types on an unlockcount- the number of lock counts, orIRWOLockManager.ALL_LOCKSto remove all countstimeout- the lock acquisition timeout in milliseconds, orIRWOLockManager.NO_TIMEOUT; ignored for unlocks
-
-
Method Details
-
isLock
public boolean isLock()Returns whether this request acquires locks.- Returns:
truefor aIRWOLockManager.LockChange.Operation.LOCKrequest
-
isUnlock
public boolean isUnlock()Returns whether this request releases locks.- Returns:
truefor aIRWOLockManager.LockChange.Operation.UNLOCKrequest
-
getOperation
Returns the requested operation.- Returns:
- the operation
-
getObjects
Returns the immutable object collection, ornullfor all objects owned by the context.- Returns:
- the objects, or
null
-
getLockType
Returns the lock type, ornullto unlock all types.- Returns:
- the lock type, or
null
-
getCount
public int getCount()Returns the requested lock count.- Returns:
- the count, or
IRWOLockManager.ALL_LOCKSfor an unlock-all request
-
getTimeout
public long getTimeout()Returns the requested acquisition timeout.- Returns:
- the timeout in milliseconds, or
IRWOLockManager.NO_TIMEOUT
-
lock
public static <OBJECT> IRWOLockManager.LockChange<OBJECT> lock(Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count, long timeout) Creates a request to acquire a lock on each object in the given collection.- Type Parameters:
OBJECT- the locked object type- Parameters:
objects- the objects to lock; must not benulllockType- the lock type to acquirecount- the number of reentrant locks to acquiretimeout- the maximum wait in milliseconds, orIRWOLockManager.NO_TIMEOUT- Returns:
- the immutable lock request
-
unlock
public static <OBJECT> IRWOLockManager.LockChange<OBJECT> unlock(Collection<? extends OBJECT> objects, IRWLockManager.LockType lockType, int count) Creates a request to release locks from the given objects.- Type Parameters:
OBJECT- the locked object type- Parameters:
objects- the objects to unlock, ornullfor all objects owned by the contextlockType- the lock type to release, ornullfor all typescount- the number of locks to release, orIRWOLockManager.ALL_LOCKS- Returns:
- the immutable unlock request
-