Package org.eclipse.net4j.util.concurrent

# Interface IRWOLockManager<OBJECT,CONTEXT>

All Superinterfaces:
  `IRWLockManager<OBJECT,CONTEXT>`

All Known Implementing Classes:
  `RWOLockManager`

public interface IRWOLockManager<OBJECT,CONTEXT> extends IRWLockManager<OBJECT,CONTEXT>
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

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`IRWOLockManager.LockDeltaHandler<OBJECT,CONTEXT>`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.concurrent.IRWLockManager

`IRWLockManager.LockType`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final IRWLockManager.LockType`
`ALL_LOCK_TYPES`
`static final int`
`ALL_LOCKS`
`static final Collection<?>`
`ALL_OBJECTS`
`static final long`
`NO_TIMEOUT`

### Fields inherited from interface org.eclipse.net4j.util.concurrent.IRWLockManager

`NO_WAIT, WAIT`

## Method Summary

Modifier and Type
Method
Description
`long`
`getModCount()`
`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.
`List<RWOLockManager.LockState<OBJECT,CONTEXT>>`
`lock2(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout)`
Deprecated.
`void`
`unlock(CONTEXT context)`
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.
`List<RWOLockManager.LockState<OBJECT,CONTEXT>>`
`unlock2(CONTEXT context)`
Deprecated.
`List<RWOLockManager.LockState<OBJECT,CONTEXT>>`
`unlock2(CONTEXT context, Collection<? extends OBJECT> objectsToUnlock)`
Deprecated.
`List<RWOLockManager.LockState<OBJECT,CONTEXT>>`
`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

static final Collection<?> ALL_OBJECTS

Since:
  3.16

### ALL_LOCK_TYPES

static final IRWLockManager.LockType ALL_LOCK_TYPES

Since:
  3.16

### ALL_LOCKS

static final int ALL_LOCKS

Since:
  3.16
See Also:
  - Constant Field Values

### NO_TIMEOUT

static final long NO_TIMEOUT

Since:
  3.16
See Also:
  - Constant Field Values

## 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,CONTEXT>> stateHandler) throws InterruptedException, TimeoutRuntimeException
Adds locks of the given lockType, owned by the given context to the given objects.

Parameters:
  `context` - The lock context to add from the `objects`. Must not be `null`.
  `objects` - The objects to lock. Must not be `null`.
  `lockType` - The type of lock to add to the `objects`. Must not be `null`.
  `count` - The number of locks to add to each of the `objects`.
  `timeout` - The period in milliseconds after that a `TimeoutRuntimeException` is thrown if some or all of the `objects` could not be locked, or `NO_TIMEOUT` to attempt forever to acquire the requested locks.
  `deltaHandler` - A handler that is notified with each delta in a `lock state`, or `null` 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 new `lock state`, or `null` 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 the `objects` 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 the `objects`. Must not be `null`.
  `objects` - The objects to unlock, or `ALL_OBJECTS` to unlock all objects of the `context`.
  `lockType` - The type of lock to remove from the `objects`, or `ALL_LOCK_TYPES` to remove the locks of all types.
  `count` - The number of locks to remove from each of the `objects`, or `ALL_LOCKS` to remove all locks.
  `deltaHandler` - A handler that is notified with each delta in a `RWOLockManager.LockState`, or `null` if no such notification is needed.
  `stateHandler` - A handler that is notified with each new `RWOLockManager.LockState`, or `null` 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 List<RWOLockManager.LockState<OBJECT,CONTEXT>> unlock2(CONTEXT context)
Deprecated.

### lock

@Deprecated void lock(IRWLockManager.LockType lockType, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException
Deprecated.

Specified by:
  `lock` in interface `IRWLockManager<OBJECT,CONTEXT>`
Throws:
  `InterruptedException`

### lock

@Deprecated void lock(IRWLockManager.LockType lockType, CONTEXT context, OBJECT objectToLock, long timeout) throws InterruptedException
Deprecated.

Specified by:
  `lock` in interface `IRWLockManager<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 interface `IRWLockManager<OBJECT,CONTEXT>`

### unlock

@Deprecated void unlock(CONTEXT context)
Deprecated.
Description copied from interface: `IRWLockManager`
Attempts to release all locks(read and write) for a given context.

Specified by:
  `unlock` in interface `IRWLockManager<OBJECT,CONTEXT>`