@Override
  public void process(WatchedEvent watchedEvent) {
    LOG.info("Processing event: " + watchedEvent.toString());
    if (watchedEvent.getType() == Event.EventType.None) {
      switch (watchedEvent.getState()) {
        case SyncConnected:
          connected = true;
          break;
        case Disconnected:
          connected = false;
          break;
        case Expired:
          connected = false;
          LOG.error("Session expired creating again");
          try {
            createZKConnection(null);
          } catch (IOException e) {
            LOG.error("Error creating Zookeeper connection", e);
          }
        default:
          LOG.error("Unknown State");
          break;
      }
    }
  }
Below function executes command with retries with given user. Uses LocalShell to execute a
command.
@param user user name, default none
@param cmd  Command to execute
@return A pair of Exit Code and Shell output
@throws IOException Exception while executing shell command
hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosAgent.java