Interface InternalLockManager

All Superinterfaces:
IDurableLockingManager, ILockingManager, org.eclipse.net4j.util.concurrent.IRWLockManager<Object,IView>, org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>

public interface InternalLockManager extends org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>, ILockingManager
The type of the to-be-locked objects is either CDOIDAndBranch or CDOID, depending on whether branching is supported by the repository or not.

The following features are supported in addition to IRWOLockManager:

  • Recursive locking
  • Distinction between explicit and implicit locking
  • Durable locking
Since:
3.0
Author:
Eike Stepper
No Implement
This interface is not intended to be implemented by clients.
No Extend
This interface is not intended to be extended by clients.
  • Method Details

    • getRepository

      InternalRepository getRepository()
    • setRepository

      void setRepository(InternalRepository repository)
    • getLockKey

      Object getLockKey(CDOID id)
      Same as calling getLockKey(CDOID, CDOBranch) with null as branch.
      Since:
      4.25
    • getLockKey

      Object getLockKey(CDOID id, CDOBranch branch)
      Returns the lock key for the given ID. If the repository supports branching, the returned key is of type CDOIDAndBranch, otherwise it is of type CDOID.
      Parameters:
      id - the ID of the object to be locked.
      branch - the branch on which the object to be locked resides. May be null to indicate the main branch (for example if the repository does not support branching).
      Since:
      4.0
    • getLockKeyID

      CDOID getLockKeyID(Object key)
      Since:
      4.0
      See Also:
    • getLockKeyBranch

      CDOBranch getLockKeyBranch(Object key)
      Since:
      4.15
      See Also:
    • getLocks

      Since:
      4.0
    • lock

      long lock(IView view, Collection<? extends Object> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, int count, long timeout, boolean recursive, boolean explicit, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockDeltaHandler<Object,IView> deltaHandler, Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> stateHandler) throws InterruptedException, org.eclipse.net4j.util.concurrent.TimeoutRuntimeException
      Throws:
      InterruptedException
      org.eclipse.net4j.util.concurrent.TimeoutRuntimeException
      Since:
      4.15
    • unlock

      long unlock(IView view, Collection<? extends Object> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, int count, boolean recursive, boolean explicit, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockDeltaHandler<Object,IView> deltaHandler, Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> stateHandler)
      Since:
      4.15
    • changeLocks

      long changeLocks(IView view, List<? extends org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange<Object>> changes, boolean recursive, boolean explicit, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange.DeltaHandler<Object,IView> deltaHandler, Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> stateHandler) throws InterruptedException, org.eclipse.net4j.util.concurrent.TimeoutRuntimeException
      Applies one ordered set of lock changes under one in-memory write-access scope, then persists explicit durable lock changes after releasing that access.
      Parameters:
      view - the lock owner
      changes - the ordered lock and unlock requests
      recursive - whether object collections are expanded to their contained objects
      explicit - whether changes must also be persisted for a durable view
      deltaHandler - receives the effective lock-count changes
      stateHandler - receives the final state of affected objects
      Returns:
      the generic lock-manager modification count
      Throws:
      InterruptedException - if a requested lock wait is interrupted
      org.eclipse.net4j.util.concurrent.TimeoutRuntimeException - if a requested lock cannot be acquired before its timeout
      Since:
      4.27
    • changeLocksWithReservation

      InternalLockManager.LockChangeOperationResult changeLocksWithReservation(IView view, List<? extends org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange<Object>> changes, boolean recursive, boolean explicit, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockChange.DeltaHandler<Object,IView> deltaHandler, Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> stateHandler) throws InterruptedException, org.eclipse.net4j.util.concurrent.TimeoutRuntimeException
      Applies a lock change and returns its exact sequencing reservation together with the generic lock-manager modification count.
      Parameters:
      view - the lock owner
      changes - the ordered lock and unlock requests
      recursive - whether object collections are expanded to their contained objects
      explicit - whether changes must also be persisted for a durable view
      deltaHandler - receives the effective lock-count changes
      stateHandler - receives the final state of affected objects
      Returns:
      the result for this exact operation
      Throws:
      InterruptedException - if a requested lock wait is interrupted
      org.eclipse.net4j.util.concurrent.TimeoutRuntimeException - if a requested lock cannot be acquired before its timeout
      Since:
      4.27
    • reserveLockChange

      InternalLockManager.LockChangeReservationSet reserveLockChange(InternalSession[] sessions, boolean forceFull)
      Reserves a lock-change sequencing position for each open session in the given set.
      Parameters:
      sessions - the sessions that may receive the change
      forceFull - whether each resulting notification must contain the full change
      Returns:
      an aggregate reservation whose per-session results become available after completion
      Since:
      4.27
    • setDurableLockingID

      long setDurableLockingID(InternalView view, String durableLockingID)
      Changes the durable locking ID of a view and returns the exact lock-change count assigned to the resulting owner remap for that view's session.
      Parameters:
      view - the view whose durable locking ID is changed
      durableLockingID - the new durable locking ID, or null to disable durable locking
      Returns:
      the exact session lock-change count for the owner remap, or zero if no owner remap occurred
      Since:
      4.27
    • snapshotLockStates

      Returns a consistent snapshot of the lock states relevant to a session, paired with that session's exact lock-change sequence baseline.
      Parameters:
      session - the session for which relevant lock states are selected
      Returns:
      the relevant lock states and their sequence baseline
      Since:
      4.27
    • snapshotLockStates

      InternalLockManager.LockStateQuery snapshotLockStates(InternalSession session, CDOBranch branch, Collection<CDOID> ids)
      Returns lock states for the specified query targets with the session's exact lock-change sequence baseline. A null ID collection requests all lock states using normal query semantics.
      Parameters:
      session - the session whose sequence baseline is returned
      branch - the branch used to create lock keys
      ids - the target IDs, or null to query all lock states
      Returns:
      the lock states and matching session sequence baseline
      Since:
      4.27
    • createLockArea

      Since:
      4.0
    • createLockArea

      IDurableLockingManager.LockArea createLockArea(InternalView view, String lockAreaID)
      Since:
      4.1
    • updateLockArea

      void updateLockArea(IDurableLockingManager.LockArea lockArea)
      Since:
      4.1
    • openView

      void openView(ISession session, int viewID, boolean readOnly, String durableLockingID, Consumer<IView> viewConsumer, BiConsumer<CDOID,IDurableLockingManager.LockGrade> lockConsumer)
      Since:
      4.15
    • getLockGrade

      Since:
      4.1
      See Also:
    • getLockState

      org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView> getLockState(Object key)
      Since:
      4.1
      See Also:
    • getLockStates

      void getLockStates(Collection<Object> keys, BiConsumer<Object,org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> consumer)
      Since:
      4.15
      See Also:
    • getLockStates

      void getLockStates(Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> consumer)
      Since:
      4.15
    • getLockOwners

      Set<IView> getLockOwners(Object key, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType... lockTypes)
      Returns the set of views that own a lock of one of the specified types on the given key. If no lock types are specified, all lock types are considered. If no view owns a lock of the specified types, an empty set is returned.
      Since:
      4.25
      See Also:
    • getLockOwner

      IView getLockOwner(String durableLockingID)
      Since:
      4.25
    • reloadLocks

      void reloadLocks()
      Since:
      4.1
    • getLockStates

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> getLockStates()
      Deprecated.
    • setLockState

      @Deprecated void setLockState(Object key, org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView> lockState)
      Deprecated.
    • getLockEntryObject

      @Deprecated Object getLockEntryObject(Object key)
      Deprecated.
    • lock

      @Deprecated void lock(boolean explicit, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView view, Collection<? extends Object> objects, long timeout) throws InterruptedException
      Deprecated.
      Throws:
      InterruptedException
    • lock

      @Deprecated void lock(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView context, Collection<? extends Object> objectsToLock, long timeout) throws InterruptedException
      Deprecated.
      Specified by:
      lock in interface org.eclipse.net4j.util.concurrent.IRWLockManager<Object,IView>
      Specified by:
      lock in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
      Throws:
      InterruptedException
    • lock

      @Deprecated void lock(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView context, Object objectToLock, long timeout) throws InterruptedException
      Deprecated.
      Specified by:
      lock in interface org.eclipse.net4j.util.concurrent.IRWLockManager<Object,IView>
      Specified by:
      lock in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
      Throws:
      InterruptedException
    • lock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> lock2(boolean explicit, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView view, Collection<? extends Object> objects, boolean recursive, long timeout) throws InterruptedException
      Deprecated.
      Throws:
      InterruptedException
    • lock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> lock2(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView context, Collection<? extends Object> objectsToLock, long timeout) throws InterruptedException
      Deprecated.
      Specified by:
      lock2 in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
      Throws:
      InterruptedException
    • unlock

      @Deprecated void unlock(boolean explicit, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView view, Collection<? extends Object> objects)
      Deprecated.
    • unlock

      @Deprecated void unlock(boolean explicit, IView view)
      Deprecated.
    • unlock

      @Deprecated void unlock(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView context, Collection<? extends Object> objectsToUnlock)
      Deprecated.
      Specified by:
      unlock in interface org.eclipse.net4j.util.concurrent.IRWLockManager<Object,IView>
      Specified by:
      unlock in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
    • unlock

      @Deprecated void unlock(IView context)
      Deprecated.
      Specified by:
      unlock in interface org.eclipse.net4j.util.concurrent.IRWLockManager<Object,IView>
      Specified by:
      unlock in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
    • unlock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> unlock2(boolean explicit, IView view)
      Deprecated.
    • unlock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> unlock2(boolean explicit, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView view, Collection<? extends Object> objects, boolean recursive)
      Deprecated.
    • unlock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> unlock2(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, IView context, Collection<? extends Object> objectsToUnlock)
      Deprecated.
      Specified by:
      unlock2 in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
    • unlock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> unlock2(IView context, Collection<? extends Object> objectsToUnlock)
      Deprecated.
      Specified by:
      unlock2 in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
    • unlock2

      @Deprecated List<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> unlock2(IView context)
      Deprecated.
      Specified by:
      unlock2 in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
    • lock

      @Deprecated long lock(IView context, Collection<? extends Object> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, int count, long timeout, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockDeltaHandler<Object,IView> deltaHandler, Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> stateHandler) throws InterruptedException, org.eclipse.net4j.util.concurrent.TimeoutRuntimeException
      Deprecated.
      Specified by:
      lock in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
      Throws:
      InterruptedException
      org.eclipse.net4j.util.concurrent.TimeoutRuntimeException
    • unlock

      @Deprecated long unlock(IView context, Collection<? extends Object> objects, org.eclipse.net4j.util.concurrent.IRWLockManager.LockType lockType, int count, org.eclipse.net4j.util.concurrent.IRWOLockManager.LockDeltaHandler<Object,IView> deltaHandler, Consumer<org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<Object,IView>> stateHandler)
      Deprecated.
      Specified by:
      unlock in interface org.eclipse.net4j.util.concurrent.IRWOLockManager<Object,IView>
    • openView

      @Deprecated IView openView(ISession session, int viewID, boolean readOnly, String durableLockingID)
      Deprecated.