Package org.apache.flink.core.testutils
Class MultiShotLatch
- java.lang.Object
-
- org.apache.flink.core.testutils.MultiShotLatch
-
public final class MultiShotLatch extends Object
Latch for synchronizing parts of code in tests. In contrast toOneShotLatchthis will reset the state onceawait()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 callstrigger().
-
-
Constructor Summary
Constructors Constructor Description MultiShotLatch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()Waits untiltrigger()is called.booleanisTriggered()Checks if the latch was triggered.voidtrigger()Fires the latch.
-
-
-
Method Detail
-
trigger
public void trigger()
Fires the latch. Code that is blocked onawait()will now return.
-
await
public void await() throws InterruptedExceptionWaits 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.
-
-