code: public void run() {
      LOG.info("The server runs and prepares for leader election");
      if (failoverWatcher.blockUntilActive()) {
        LOG.info("The server becomes active master and prepare to do business logic");
        doAsActiveServer();
      }
      failoverWatcher.close();
      LOG.info("The server exits after running business logic");
    }
docs: The main logic of active/backup servers.