Class UninterruptibleCountDownLatch


  • public final class UninterruptibleCountDownLatch
    extends CountDownLatch
    Enhanced CountDownLatch providing uninterruptible variants of await() methods.
    Author:
    Richard Opalka
    • Constructor Detail

      • UninterruptibleCountDownLatch

        public UninterruptibleCountDownLatch​(int count)
    • Method Detail

      • awaitUninterruptibly

        public void awaitUninterruptibly()
        Behaves the same way as CountDownLatch.await() except it never throws InterruptedException. Thread interrupt status will be preserved if thread have been interrupted inside this method.
      • awaitUninterruptibly

        public boolean awaitUninterruptibly​(long timeout,
                                            TimeUnit unit)
        Behaves the same way as CountDownLatch.await(long,TimeUnit) except it never throws InterruptedException. Thread interrupt status will be preserved if thread have been interrupted inside this method.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Returns:
        true if the count reached zero and false if the waiting time elapsed before the count reached zero