de.esprit.common.concurrent

## Class RecloseableGate

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

-     public class RecloseableGate
      extends java.lang.Object

  This class implements a gate that can be opened and closed as needed. Once opened all awaiting threads that have been queued up until this time are released. Further coming threads are no more blocked unless the gate is closed again.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecloseableGate()`
    `RecloseableGate(boolean isOpen)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `await()` Waits for the gate to open.
    `boolean` | `await(long time, java.util.concurrent.TimeUnit unit)` Waits for the gate to open or the specified time to elapse.
    `void` | `awaitTimingOut(long time, java.util.concurrent.TimeUnit unit)` Same as `await()` but throws a TimeoutException if the gate was not opened in time.
    `void` | `awaitUniterruptibly()`
    `void` | `close()`
    `boolean` | `isOpen()`
    `void` | `open()`

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

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

- - ### Constructor Detail

    - #### RecloseableGate

          public RecloseableGate()

    - #### RecloseableGate

          public RecloseableGate(boolean isOpen)

  - ### Method Detail

    - #### open

          public void open()

    - #### close

          public void close()

    - #### isOpen

          public boolean isOpen()

    - #### await

          public void await()
                     throws java.lang.InterruptedException

      Waits for the gate to open.
      Throws:
        `java.lang.InterruptedException`

    - #### await

          public boolean await(long time,
                      java.util.concurrent.TimeUnit unit)
                        throws java.lang.InterruptedException

      Waits for the gate to open or the specified time to elapse.
      Throws:
        `java.lang.InterruptedException`

    - #### awaitTimingOut

          public void awaitTimingOut(long time,
                            java.util.concurrent.TimeUnit unit)
                              throws java.lang.InterruptedException,
                                     java.util.concurrent.TimeoutException

      Same as `await()` but throws a TimeoutException if the gate was not opened in time.
      Throws:
        `java.lang.InterruptedException`
        `java.util.concurrent.TimeoutException`

    - #### awaitUniterruptibly

          public void awaitUniterruptibly()

Copyright © 2014 EsprIT-Systems. All Rights Reserved.