private boolean isValid() {
      return generation == zkUtils.getGeneration();
    }
A generation-aware {@link IZkDataListener} 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