@Override
    public void process(WatchedEvent watchedEvent) {
      LOG.info("Setting status watch for task: " + watchedEvent.getPath());
      if (watchedEvent.getType() == Event.EventType.NodeDataChanged) {
        if (!watchedEvent.getPath().contains(TASK_PREFIX)) {
          throw new RuntimeException(
            KeeperException.create(KeeperException.Code.DATAINCONSISTENCY));
        }
        getStatus(watchedEvent.getPath(), (Object) watchedEvent.getPath());

      }
    }
Watcher to get notification whenever status of task changes.
hbase-it/src/test/java/org/apache/hadoop/hbase/ChaosZKClient.java