com.sleepycat.je.rep.utilint
Class RepUtils.ExceptionAwareCountDownLatch

java.lang.Object
  extended by java.util.concurrent.CountDownLatch
      extended by com.sleepycat.je.rep.utilint.RepUtils.ExceptionAwareCountDownLatch
Enclosing class:
RepUtils

public static class RepUtils.ExceptionAwareCountDownLatch
extends CountDownLatch

Like CountDownLatch, but makes provision in the await for the await, or more specifically the new awaitOrException method to be exited via an exception.


Field Summary
(package private)  EnvironmentImpl envImpl
           
 
Constructor Summary
RepUtils.ExceptionAwareCountDownLatch(EnvironmentImpl envImpl, int count)
           
 
Method Summary
 boolean await(long timeout, TimeUnit unit)
          Deprecated. 
 void awaitOrException()
           
 boolean awaitOrException(long timeout, TimeUnit unit)
          Blocks, waiting for the latch to count down to zero, or until an Exception is provided.
 void releaseAwait(Exception exception)
          The method used to free an await, ensuring that it throws an exception at the awaitOrException.
 
Methods inherited from class java.util.concurrent.CountDownLatch
await, countDown, getCount, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

envImpl

final EnvironmentImpl envImpl
Constructor Detail

RepUtils.ExceptionAwareCountDownLatch

public RepUtils.ExceptionAwareCountDownLatch(EnvironmentImpl envImpl,
                                             int count)
Method Detail

releaseAwait

public void releaseAwait(Exception exception)
The method used to free an await, ensuring that it throws an exception at the awaitOrException.

Parameters:
exception - the exception to be wrapped in a DatabaseException and thrown.

awaitOrException

public boolean awaitOrException(long timeout,
                                TimeUnit unit)
                         throws InterruptedException,
                                DatabaseException
Blocks, waiting for the latch to count down to zero, or until an Exception is provided. The exception is thrown in every thread that is waiting in this method.

Throws:
InterruptedException
DatabaseException
See Also:
releaseAwait(java.lang.Exception)

awaitOrException

public void awaitOrException()
                      throws InterruptedException,
                             DatabaseException
Throws:
InterruptedException
DatabaseException

await

@Deprecated
public boolean await(long timeout,
                                TimeUnit unit)
Deprecated. 

DO NOT use this method. Use awaitOrException instead, so that any outstanding exceptions are thrown.

Overrides:
await in class CountDownLatch


Copyright (c) 2004-2012 Oracle. All rights reserved.