Class LocalTaskQueueTestConfig.TaskCountDownLatch
java.lang.Object
java.util.concurrent.CountDownLatch
com.google.appengine.tools.development.testing.jakarta.LocalTaskQueueTestConfig.TaskCountDownLatch
- Enclosing class:
LocalTaskQueueTestConfig
A
} when
you need to reuse the latch within or across tests. Only one thread at a
time should ever call any of the
CountDownLatch extension that can be reset. Pass an instance of
this class to
invalid @link
{@link LocalTaskQueueTestConfig#setTaskExecutionLatch)
await() or reset() methods.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidawait()Only one thread at a time should call this.booleanOnly one thread at a time should call this.voidvoidawaitAndReset(int count) Shorthand for callingawait()followed byreset(int).booleanawaitAndReset(long timeout, TimeUnit unit) Shorthand for callingawait(long, java.util.concurrent.TimeUnit)followed byreset().booleanawaitAndReset(long timeout, TimeUnit unit, int count) Shorthand for callingawait(long, java.util.concurrent.TimeUnit)followed byreset(int).voidlonggetCount()voidreset()Resets the latch to its most recent initial count.voidreset(int count) Resets the latch to the provided count.toString()
-
Constructor Details
-
TaskCountDownLatch
public TaskCountDownLatch(int count)
-
-
Method Details
-
getCount
public long getCount()- Overrides:
getCountin classCountDownLatch
-
toString
- Overrides:
toStringin classCountDownLatch
-
await
Only one thread at a time should call this.- Overrides:
awaitin classCountDownLatch- Throws:
InterruptedException
-
await
Only one thread at a time should call this.- Overrides:
awaitin classCountDownLatch- Throws:
InterruptedException
-
countDown
public void countDown()- Overrides:
countDownin classCountDownLatch
-
awaitAndReset
- Throws:
InterruptedException
-
awaitAndReset
Shorthand for callingawait()followed byreset(int). Only one thread at a time should call this.- Throws:
InterruptedException
-
awaitAndReset
Shorthand for callingawait(long, java.util.concurrent.TimeUnit)followed byreset(). Only one thread at a time should call this.- Throws:
InterruptedException
-
awaitAndReset
Shorthand for callingawait(long, java.util.concurrent.TimeUnit)followed byreset(int). Only one thread at a time should call this.- Throws:
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.
-