public void start(Consumer<UpdateRackHeartbeat> consumer,
                    Result<Integer> result)
  {
    if (_selfServer.port() < 0) {
      result.ok(0);
      return;
    }
    
    // boolean isPendingStart = false;
    
    ArrayList<ClusterHeartbeat> clusterList = new ArrayList<>();
    for (ClusterHeartbeat cluster : _root.getClusters()) {
      clusterList.add(cluster);
    }
    
    if (clusterList.size() == 0) {
      result.ok(0);
      return;
    }
    
    /*
    Result<Integer>[]resultFork = result.fork(clusterList.size(),
                                              (x,r)->addInt(x,null,r),
                                              (x,y,r)->addInt(x,y,r));
                                              */
    Fork<Integer,Integer> fork = result.fork();
    
    for (int i = 0; i < clusterList.size(); i++) {
      ClusterHeartbeat cluster = clusterList.get(i);
      
      startCluster(cluster, consumer, fork.branch()); // resultFork[i]);
    }
    
    fork.fail((v,f,r)->addInt(v,f,r));
    fork.join((v,r)->addInt(v,null,r));
    
    /*
    for (ClusterHeartbeat cluster : _root.getClusters()) {
      if (! _selfServer.getClusterId().equals(cluster.getId())) {
        startCluster(cluster, cont);
      }
    }
    */
  }
public void start ( Consumer < UpdateRackHeartbeat > consumer , Result < Integer > result ) { if ( _selfServer . port ( ) < 0 ) { result . ok ( 0 ) ; return ; } ArrayList < ClusterHeartbeat > clusterList = new ArrayList < > ( ) ; for ( ClusterHeartbeat cluster : _root . getClusters ( ) ) { clusterList . add ( cluster ) ; } if ( clusterList . size ( ) == 0 ) { result . ok ( 0 ) ; return ; } Fork < Integer , Integer > fork = result . fork ( ) ; for ( int i = 0 ; i < clusterList . size ( ) ; i ++ ) { ClusterHeartbeat cluster = clusterList . get ( i ) ; startCluster ( cluster , consumer , fork . branch ( ) ) ; } fork . fail ( ( v , f , r ) -> addInt ( v , f , r ) ) ; fork . join ( ( v , r ) -> addInt ( v , null , r ) ) ; }
/*
public int getJoinServerCount()
{
return _joinCount;
}