コード例 #1
0
ファイル: ClusterManagerImpl.java プロジェクト: alesj/hornetq
  // backup node becomes live
  public synchronized void activate() {
    if (backup) {
      backup = false;

      for (BroadcastGroup broadcastGroup : broadcastGroups.values()) {
        try {
          broadcastGroup.start();
          broadcastGroup.activate();
        } catch (Exception e) {
          log.warn("unable to start broadcast group " + broadcastGroup.getName(), e);
        }
      }

      for (ClusterConnection clusterConnection : clusterConnections.values()) {
        try {
          clusterConnection.activate();
        } catch (Exception e) {
          log.warn("unable to start cluster connection " + clusterConnection.getName(), e);
        }
      }

      for (Bridge bridge : bridges.values()) {
        try {
          bridge.start();
        } catch (Exception e) {
          log.warn("unable to start bridge " + bridge.getName(), e);
        }
      }
    }
  }
コード例 #2
0
ファイル: ClusterManagerImpl.java プロジェクト: alesj/hornetq
  public void stop() throws Exception {
    synchronized (this) {
      if (!started) {
        return;
      }

      if (clustered) {
        for (BroadcastGroup group : broadcastGroups.values()) {
          group.stop();
          managementService.unregisterBroadcastGroup(group.getName());
        }

        broadcastGroups.clear();

        for (ClusterConnection clusterConnection : clusterConnections.values()) {
          clusterConnection.stop();
          managementService.unregisterCluster(clusterConnection.getName().toString());
        }
      }

      for (Bridge bridge : bridges.values()) {
        bridge.stop();
        managementService.unregisterBridge(bridge.getName().toString());
      }

      bridges.clear();
    }

    for (ServerLocatorInternal clusterLocator : clusterLocators) {
      try {
        clusterLocator.close();
      } catch (Exception e) {
        log.warn(
            "Error closing serverLocator=" + clusterLocator + ", message=" + e.getMessage(), e);
      }
    }
    clusterLocators.clear();
    started = false;

    clearClusterConnections();
  }