de.esprit.common.concurrent

## Class OneShotGate

- java.lang.Object
- - de.esprit.common.concurrent.OneShotGate

- Direct Known Subclasses:
    ClientCommitGate

      public class OneShotGate
      extends java.lang.Object

  This class implements a gate that can once be opened and will remain open forever. On open all awaiting threads, that have been queued up until this time, are released. Further coming threads will not be blocked any more.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OneShotGate()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `await()` All threads entering this method are blocked until the gate is opened.
    `void` | `await(long millis)` Waits at longest for the given millis without throwing a `TimeoutException`.
    `long` | `awaitNonInterruptible()` Lets the calling thread wait on the gate in a non interruptible mode
    `long` | `awaitTimingOut(long millis)` Waits at longest for the given millis and throws a `TimeoutException` if the expected wait time was exceeded.
    `boolean` | `isOpen()` Tells whether the gate has been opened.
    `void` | `open()` Opens the gate forever.

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

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

- - ### Constructor Detail

    - #### OneShotGate

          public OneShotGate()

  - ### Method Detail

    - #### open

          public void open()

      Opens the gate forever.

    - #### isOpen

          public boolean isOpen()

      Tells whether the gate has been opened.

    - #### await

          public long await()
                     throws java.lang.InterruptedException

      All threads entering this method are blocked until the gate is opened.
      Returns:
        the duration that we actually waited.
      Throws:
        `java.lang.InterruptedException`

    - #### awaitNonInterruptible

          public long awaitNonInterruptible()

      Lets the calling thread wait on the gate in a non interruptible mode

    - #### await

          public void await(long millis)
                     throws java.lang.InterruptedException

      Waits at longest for the given millis without throwing a `TimeoutException`.
      Throws:
        `java.lang.InterruptedException`

    - #### awaitTimingOut

          public long awaitTimingOut(long millis)
                              throws java.lang.InterruptedException,
                                     java.util.concurrent.TimeoutException

      Waits at longest for the given millis and throws a `TimeoutException` if the expected wait time was exceeded.
      Throws:
        `InterruptedException,` - TimeoutException
        `java.lang.InterruptedException`
        `java.util.concurrent.TimeoutException`

Copyright © 2012 EsprIT-Systems. All Rights Reserved.