Exemplo n.º 1
0
  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();
  }
Exemplo n.º 2
0
  public void stop() throws Exception {
    synchronized (this) {
      if (state == State.STOPPED || state == State.STOPPING) {
        return;
      }
      state = State.STOPPING;

      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) {
        HornetQServerLogger.LOGGER.errorClosingServerLocator(e, clusterLocator);
      }
    }
    clusterLocators.clear();
    state = State.STOPPED;

    clearClusterConnections();
  }