com.google.appengine.tools.development.testing
Class LocalTaskQueueTestConfig.TaskCountDownLatch

java.lang.Object
  extended by java.util.concurrent.CountDownLatch
      extended by com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig.TaskCountDownLatch
Enclosing class:
LocalTaskQueueTestConfig

public static final class LocalTaskQueueTestConfig.TaskCountDownLatch
extends java.util.concurrent.CountDownLatch

A CountDownLatch extension that can be reset. Pass an instance of this class to LocalTaskQueueTestConfig#setTaskExecutionLatch) when you need to reuse the latch within or across tests. Only one thread at a time should ever call any of the await() or reset() methods.


Constructor Summary
LocalTaskQueueTestConfig.TaskCountDownLatch(int count)
           
 
Method Summary
 void await()
           
 boolean await(long timeout, java.util.concurrent.TimeUnit unit)
           
 void awaitAndReset()
          Shorthand for calling await() followed by reset().
 void awaitAndReset(int count)
          Shorthand for calling await() followed by reset(int).
 boolean awaitAndReset(long timeout, java.util.concurrent.TimeUnit unit)
          Shorthand for calling await(long, java.util.concurrent.TimeUnit) followed by reset().
 boolean awaitAndReset(long timeout, java.util.concurrent.TimeUnit unit, int count)
          Shorthand for calling await(long, java.util.concurrent.TimeUnit) followed by reset(int).
 void countDown()
           
 long getCount()
           
 void reset()
          Resets the latch to its most recent initial count.
 void reset(int count)
          Resets the latch to the provided count.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalTaskQueueTestConfig.TaskCountDownLatch

public LocalTaskQueueTestConfig.TaskCountDownLatch(int count)
Method Detail

getCount

public long getCount()
Overrides:
getCount in class java.util.concurrent.CountDownLatch

toString

public java.lang.String toString()
Overrides:
toString in class java.util.concurrent.CountDownLatch

await

public void await()
           throws java.lang.InterruptedException
Overrides:
await in class java.util.concurrent.CountDownLatch
Throws:
java.lang.InterruptedException

await

public boolean await(long timeout,
                     java.util.concurrent.TimeUnit unit)
              throws java.lang.InterruptedException
Overrides:
await in class java.util.concurrent.CountDownLatch
Throws:
java.lang.InterruptedException

countDown

public void countDown()
Overrides:
countDown in class java.util.concurrent.CountDownLatch

awaitAndReset

public void awaitAndReset()
                   throws java.lang.InterruptedException
Shorthand for calling await() followed by reset(). Only one thread at a time should call this.

Throws:
java.lang.InterruptedException

awaitAndReset

public void awaitAndReset(int count)
                   throws java.lang.InterruptedException
Shorthand for calling await() followed by reset(int). Only one thread at a time should call this.

Throws:
java.lang.InterruptedException

awaitAndReset

public boolean awaitAndReset(long timeout,
                             java.util.concurrent.TimeUnit unit)
                      throws java.lang.InterruptedException
Shorthand for calling await(long, java.util.concurrent.TimeUnit) followed by reset(). Only one thread at a time should call this.

Throws:
java.lang.InterruptedException

awaitAndReset

public boolean awaitAndReset(long timeout,
                             java.util.concurrent.TimeUnit unit,
                             int count)
                      throws java.lang.InterruptedException
Shorthand for calling await(long, java.util.concurrent.TimeUnit) followed by reset(int). Only one thread at a time should call this.

Throws:
java.lang.InterruptedException

reset

public void reset()
Resets the latch to its most recent initial count. Only one thread at a time should call this.


reset

public void reset(int count)
Resets the latch to the provided count. Only one thread at a time should call this.