Esempio n. 1
0
 public void rejoin() {
   systemLogService.logJoin("Rejoining!");
   masterAddress = null;
   joined.set(false);
   clusterService.reset();
   failedConnections.clear();
   join();
 }
Esempio n. 2
0
  void start() {
    nodeEngine.start();
    connectionManager.start();
    if (config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled()) {
      final Thread multicastServiceThread =
          new Thread(
              hazelcastThreadGroup.getInternalThreadGroup(),
              multicastService,
              hazelcastThreadGroup.getThreadNamePrefix("MulticastThread"));
      multicastServiceThread.start();
    }
    if (groupProperties.getBoolean(GroupProperty.DISCOVERY_SPI_ENABLED)) {
      discoveryService.start();
    }

    if (groupProperties.getBoolean(GroupProperty.SHUTDOWNHOOK_ENABLED)) {
      logger.finest("Adding ShutdownHook");
      Runtime.getRuntime().addShutdownHook(shutdownHookThread);
    }
    state = NodeState.ACTIVE;

    join();
    int clusterSize = clusterService.getSize();
    if (config.getNetworkConfig().isPortAutoIncrement()
        && address.getPort() >= config.getNetworkConfig().getPort() + clusterSize) {
      StringBuilder sb = new StringBuilder("Config seed port is ");
      sb.append(config.getNetworkConfig().getPort());
      sb.append(" and cluster size is ");
      sb.append(clusterSize);
      sb.append(". Some of the ports seem occupied!");
      logger.warning(sb.toString());
    }
    try {
      managementCenterService = new ManagementCenterService(hazelcastInstance);
    } catch (Exception e) {
      logger.warning("ManagementCenterService could not be constructed!", e);
    }
    nodeExtension.afterStart(this);
    versionCheck.check(this, getBuildInfo().getVersion(), buildInfo.isEnterprise());
  }
Esempio n. 3
0
 public void start() {
   logger.finest(
       "We are asked to start and completelyShutdown is " + String.valueOf(completelyShutdown));
   if (completelyShutdown) return;
   nodeEngine.start();
   connectionManager.start();
   if (config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled()) {
     final Thread multicastServiceThread =
         new Thread(
             hazelcastInstance.threadGroup,
             multicastService,
             getThreadNamePrefix("MulticastThread"));
     multicastServiceThread.start();
   }
   setActive(true);
   if (!completelyShutdown) {
     logger.finest("Adding ShutdownHook");
     Runtime.getRuntime().addShutdownHook(shutdownHookThread);
   }
   logger.finest("finished starting threads, calling join");
   join();
   int clusterSize = clusterService.getSize();
   if (config.getNetworkConfig().isPortAutoIncrement()
       && address.getPort() >= config.getNetworkConfig().getPort() + clusterSize) {
     StringBuilder sb = new StringBuilder("Config seed port is ");
     sb.append(config.getNetworkConfig().getPort());
     sb.append(" and cluster size is ");
     sb.append(clusterSize);
     sb.append(". Some of the ports seem occupied!");
     logger.warning(sb.toString());
   }
   try {
     managementCenterService = new ManagementCenterService(hazelcastInstance);
   } catch (Exception e) {
     logger.warning("ManagementCenterService could not be constructed!", e);
   }
   initializer.afterInitialize(this);
 }