Package org.apache.flink.core.testutils
Class MultiShotLatch
java.lang.Object
org.apache.flink.core.testutils.MultiShotLatch
Latch for synchronizing parts of code in tests. In contrast to
OneShotLatch this will
reset the state once await() returns.
A part of the code that should only run after other code calls await(). The call will
only return once the other part is finished and calls trigger().
-
Constructor Details
-
MultiShotLatch
public MultiShotLatch()
-
-
Method Details
-
trigger
public void trigger()Fires the latch. Code that is blocked onawait()will now return. -
await
Waits untiltrigger()is called.- Throws:
InterruptedException
-
isTriggered
public boolean isTriggered()Checks if the latch was triggered.- Returns:
- True, if the latch was triggered, false if not.
-