com.h3c.util.concurrent

## Class LockCriticalSectionExecutor

- java.lang.Object
- - com.h3c.util.concurrent.LockCriticalSectionExecutor

- All Implemented Interfaces:
    CriticalSectionExecutor

      public class LockCriticalSectionExecutor
      extends Object
      implements CriticalSectionExecutor

  Critical section executor that uses a `Lock` as the underlying mechanism for synchronization.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LockCriticalSectionExecutor(Lock lock)` Creates a `CriticalSectionExecutor`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute(Instruction instruction)` Executes a set of instructions as critical section (Mutual excluded).
    `void` | `execute(Instruction instruction, javax.measure.Measurable<javax.measure.quantity.Duration> timeout)` Executes a set of instructions as critical section (Mutual excluded).
    `<T> T` | `execute(Procedure<T> procedure)` Executes a procedure as critical section (Mutual excluded).
    `<T> T` | `execute(Procedure<T> procedure, javax.measure.Measurable<javax.measure.quantity.Duration> timeout)` Executes a procedure as critical section (Mutual excluded).

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

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

- - ### Constructor Detail

    - #### LockCriticalSectionExecutor

          public LockCriticalSectionExecutor(Lock lock)

      Creates a `CriticalSectionExecutor`.
      Parameters:
        `lock` - lock

  - ### Method Detail

    - #### execute

          public void execute(Instruction instruction)

      Description copied from interface: `CriticalSectionExecutor`
      Executes a set of instructions as critical section (Mutual excluded).
      Specified by:
        `execute` in interface `CriticalSectionExecutor`
      Parameters:
        `instruction` - instruction to execute

    - #### execute

          public void execute(Instruction instruction,
                     javax.measure.Measurable<javax.measure.quantity.Duration> timeout)
                       throws TimeoutException

      Description copied from interface: `CriticalSectionExecutor`
      Executes a set of instructions as critical section (Mutual excluded).
      Specified by:
        `execute` in interface `CriticalSectionExecutor`
      Parameters:
        `instruction` - instruction to execute
        `timeout` - the maximum time to wait, null to wait indefinitely
      Throws:
        `TimeoutException` - if the operation times out

    - #### execute

          public <T> T execute(Procedure<T> procedure)

      Description copied from interface: `CriticalSectionExecutor`
      Executes a procedure as critical section (Mutual excluded).
      Specified by:
        `execute` in interface `CriticalSectionExecutor`
      Parameters:
        `procedure` - procedure to execute
      Returns:
        the procedure result

    - #### execute

          public <T> T execute(Procedure<T> procedure,
                      javax.measure.Measurable<javax.measure.quantity.Duration> timeout)
                    throws TimeoutException

      Description copied from interface: `CriticalSectionExecutor`
      Executes a procedure as critical section (Mutual excluded).
      Specified by:
        `execute` in interface `CriticalSectionExecutor`
      Parameters:
        `procedure` - procedure to execute
        `timeout` - the maximum time to wait, null to wait indefinitely
      Returns:
        the procedure result
      Throws:
        `TimeoutException` - if the operation times out

Copyright © 2014. All Rights Reserved.