com.hammurapi.store

## Class DeputyLock

- java.lang.Object
- - com.hammurapi.store.DeputyLock

- All Implemented Interfaces:
    TrackingLock, Lock

      public class DeputyLock
      extends Object
      implements TrackingLock

  Lock which acts on behalf of another lock and acquires its own lock only if the master lock is not held. This lock is used for executing one logical store operation in multiple threads.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeputyLock(Lock master, boolean masterLocked, boolean canNotBeLocked, String msg)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isLocked()`
    `void` | `lock()`
    `void` | `lockInterruptibly()`
    `Condition` | `newCondition()`
    `boolean` | `tryLock()`
    `boolean` | `tryLock(long time, TimeUnit unit)`
    `void` | `unlock()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DeputyLock

          public DeputyLock(Lock master,
                    boolean masterLocked,
                    boolean canNotBeLocked,
                    String msg)

  - ### Method Detail

    - #### lock

          public void lock()

      Specified by:
        `lock` in interface `Lock`

    - #### lockInterruptibly

          public void lockInterruptibly()
                                 throws InterruptedException

      Specified by:
        `lockInterruptibly` in interface `Lock`
      Throws:
        `InterruptedException`

    - #### tryLock

          public boolean tryLock()

      Specified by:
        `tryLock` in interface `Lock`

    - #### tryLock

          public boolean tryLock(long time,
                        TimeUnit unit)
                          throws InterruptedException

      Specified by:
        `tryLock` in interface `Lock`
      Throws:
        `InterruptedException`

    - #### unlock

          public void unlock()

      Specified by:
        `unlock` in interface `Lock`

    - #### isLocked

          public boolean isLocked()

      Specified by:
        `isLocked` in interface `TrackingLock`

    - #### newCondition

          public Condition newCondition()

      Specified by:
        `newCondition` in interface `Lock`