private Runnable getParticipantRunnable(int latchSize, String latchId, String participantId) {
    return new Runnable() {
      @Override
      public void run() {
        ZkUtils zkUtils = getZkUtilsWithNewClient(participantId);
        zkUtils.connect();
        ZkProcessorLatch latch = new ZkProcessorLatch(
            latchSize, latchId, participantId, zkUtils);
        latch.countDown();
        try {
          latch.await(30, TimeUnit.SECONDS);
        } catch (Exception e) {
          Assert.fail(String.format("Threw an exception while waiting for latch completion in %s! %s",
              participantId, e.getLocalizedMessage()));
        } finally {
          zkUtils.close();
        }
      }
    };
  }
The ZkProcessorLatch uses a shared Znode as a latch. Each participant await existence of a target znode under the
shared latch, which is a persistent, sequential target znode with value (latchSize - 1). latchSize is the minimum
number of participants that need to join the latch.
samza-core/src/test/java/org/apache/samza/zk/TestZkProcessorLatch.java