Ejemplo n.º 1
0
  private void postJoin() {
    blacklistedAddresses.clear();

    if (logger.isFinestEnabled()) {
      logger.finest(
          "PostJoin master: " + node.getMasterAddress() + ", isMaster: " + node.isMaster());
    }
    if (node.getState() != NodeState.ACTIVE) {
      return;
    }
    if (tryCount.incrementAndGet() == JOIN_TRY_COUNT) {
      logger.warning("Join try count exceed limit, setting this node as master!");
      node.setAsMaster();
    }

    if (node.joined()) {
      if (!node.isMaster()) {
        ensureConnectionToAllMembers();
      }

      if (clusterService.getSize() == 1) {
        logger.info('\n' + node.clusterService.membersString());
      }
    }
  }
Ejemplo n.º 2
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.º 3
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);
    }
  }