コード例 #1
0
ファイル: TopologyBuilder.java プロジェクト: curphey/stratos
  public static void handleServiceRemoved(List<Cartridge> cartridgeList) {
    Topology topology = TopologyManager.getTopology();

    for (Cartridge cartridge : cartridgeList) {
      Service service = topology.getService(cartridge.getType());
      if (service == null) {
        log.warn("Cartridge does not exist [cartidge] " + cartridge);
        return;
      }
      if (service.getClusters().size() == 0) {
        if (topology.serviceExists(cartridge.getType())) {
          try {
            TopologyManager.acquireWriteLock();
            topology.removeService(cartridge.getType());
            TopologyManager.updateTopology(topology);
          } finally {
            TopologyManager.releaseWriteLock();
          }
          TopologyEventPublisher.sendServiceRemovedEvent(cartridgeList);
        } else {
          log.warn(String.format("Service %s does not exist..", cartridge.getType()));
        }
      } else {
        log.warn(
            "Subscription already exists. Hence not removing the service:"
                + cartridge.getType()
                + " from the topology");
      }
    }
  }