code: public HostAvailabilityListener withMinHosts(int numHosts) {
      if (moveMgr.getConnectionType() == DatabaseClient.ConnectionType.GATEWAY) {
        if (numHosts != 1) {
          throw new IllegalArgumentException("numHosts must be 1 when using only the primary host for the connection");
        }
      } else {
        if (numHosts <= 0) throw new IllegalArgumentException("numHosts must be > 0");
  // TODO: use existing forest configuration instead of refreshing?
        int numConfigHosts = moveMgr.readForestConfig().getPreferredHosts().length;
        if (numHosts > numConfigHosts) throw new IllegalArgumentException
            ("numHosts must be less than or equal to the number of hosts in the cluster");
      }
      this.minHosts = numHosts;
      return this;
    }
docs: If less than minHosts are left, calls stopJob.
  
  @param numHosts the minimum number of hosts before this will call dataMovementMangaer.stopJob(batcher)
  
  @return this instance (for method chaining)