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 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 on await() will now return.
    • await

      public void await() throws InterruptedException
      Waits until trigger() is called.
      Throws:
      InterruptedException
    • isTriggered

      public boolean isTriggered()
      Checks if the latch was triggered.
      Returns:
      True, if the latch was triggered, false if not.