Ejemplo n.º 1
0
 public void join() {
   final long joinStartTime = joiner != null ? joiner.getStartTime() : Clock.currentTimeMillis();
   final long maxJoinMillis = getGroupProperties().MAX_JOIN_SECONDS.getInteger() * 1000;
   try {
     if (joiner == null) {
       logger.warning("No join method is enabled! Starting standalone.");
       setAsMaster();
     } else {
       joiner.join(joined);
     }
   } catch (Exception e) {
     if (Clock.currentTimeMillis() - joinStartTime < maxJoinMillis) {
       logger.warning("Trying to rejoin: " + e.getMessage());
       rejoin();
     } else {
       logger.severe("Could not join cluster, shutting down!", e);
       shutdown(false, true);
     }
   }
 }
Ejemplo n.º 2
0
  public void join() {
    if (joiner == null) {
      logger.warning("No join method is enabled! Starting standalone.");
      setAsMaster();
      return;
    }

    try {
      masterAddress = null;
      joined.set(false);
      clusterService.reset();

      joiner.join();
    } catch (Throwable e) {
      logger.severe("Error while joining the cluster!", e);
    }

    if (!joined()) {
      long maxJoinTimeMillis = groupProperties.getMillis(GroupProperty.MAX_JOIN_SECONDS);
      logger.severe("Could not join cluster in " + maxJoinTimeMillis + " ms. Shutting down now!");
      shutdownNodeByFiringEvents(Node.this, true);
    }
  }