@Override
    public void handleChildChange(String barrierParticipantPath, List<String> participantIds) throws Exception {
      int currentGeneration = zkUtils.getGeneration();
      if (currentGeneration != generation) {
        LOG.warn(String.format("Skipping handleChildChange for %s from wrong generation. Current generation: %s; " +
            "Callback generation: %s", listenerName, currentGeneration, generation));
        return;
      }
      doHandleChildChange(barrierParticipantPath, participantIds);
    }
A generation-aware {@link IZkChildListener} that only responds to events that occur in the current-generation.
Each generation is identified by a generation-id which is scoped to the currently active Zk session and
is incremented each time a session expires. This ensures that events corresponding to the previous generation
are not acted on.
samza-core/src/main/java/org/apache/samza/zk/ZkUtils.java