org.eclipse.net4j.util.concurrent

## Class RWOLockManager.LockState<OBJECT,CONTEXT>

- java.lang.Object
- - org.eclipse.net4j.util.concurrent.RWOLockManager.LockState<OBJECT,CONTEXT>

- Enclosing class:
    RWOLockManager<OBJECT,CONTEXT>

      public static class RWOLockManager.LockState<OBJECT,CONTEXT>
      extends Object

  Represents a combination of locks for one OBJECT. The different lock types are represented by the values of the enum `IRWLockManager.LockType`

  The locking semantics established by this class are as follows:

  - A read lock prevents a write lock by another, but allows read locks by others and allows a write option by another, and is therefore non-exclusive.
  - A write lock prevents read locks by others, a write lock by another, and a write option by another, and is therefore exclusive.
  - A write option prevents write locks by others and a write option by another, but allows read locks by others, and is therefore exclusive.
  Since:
    3.2
  Author:
    Caspar De Groot

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `OBJECT` | `getLockedObject()`
    `Set<CONTEXT>` | `getReadLockOwners()`
    `CONTEXT` | `getWriteLockOwner()`
    `CONTEXT` | `getWriteOptionOwner()`
    `int` | `hashCode()`
    `boolean` | `hasLock(IRWLockManager.LockType type)`
    `boolean` | `hasLock(IRWLockManager.LockType type, CONTEXT view, boolean byOthers)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getLockedObject

          public OBJECT getLockedObject()

    - #### hasLock

          public boolean hasLock(IRWLockManager.LockType type,
                                 CONTEXT view,
                                 boolean byOthers)

    - #### hasLock

          public boolean hasLock(IRWLockManager.LockType type)

    - #### getReadLockOwners

          public Set<CONTEXT> getReadLockOwners()

    - #### getWriteLockOwner

          public CONTEXT getWriteLockOwner()

    - #### getWriteOptionOwner

          public CONTEXT getWriteOptionOwner()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html