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>

public static final class IRWOLockManager.LockChange<OBJECT> extends Object
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
  • Constructor Details

  • Method Details

    • isLock

      public boolean isLock()
      Returns whether this request acquires locks.
      Returns:
      true for a IRWOLockManager.LockChange.Operation.LOCK request
    • isUnlock

      public boolean isUnlock()
      Returns whether this request releases locks.
      Returns:
      true for a IRWOLockManager.LockChange.Operation.UNLOCK request
    • getOperation

      public IRWOLockManager.LockChange.Operation getOperation()
      Returns the requested operation.
      Returns:
      the operation
    • getObjects

      public Collection<? extends OBJECT> getObjects()
      Returns the immutable object collection, or null for all objects owned by the context.
      Returns:
      the objects, or null
    • getLockType

      public IRWLockManager.LockType getLockType()
      Returns the lock type, or null to unlock all types.
      Returns:
      the lock type, or null
    • getCount

      public int getCount()
      Returns the requested lock count.
      Returns:
      the count, or IRWOLockManager.ALL_LOCKS for 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 be null
      lockType - the lock type to acquire
      count - the number of reentrant locks to acquire
      timeout - the maximum wait in milliseconds, or IRWOLockManager.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, or null for all objects owned by the context
      lockType - the lock type to release, or null for all types
      count - the number of locks to release, or IRWOLockManager.ALL_LOCKS
      Returns:
      the immutable unlock request