コード例 #1
0
    @Override
    public void processClusterEvent(ClusterEvent clusterEvent) {
      ClusterEventType clusterEventType = clusterEvent.getClusterEventType();

      if (!clusterEventType.equals(ClusterEventType.JOIN)) {
        return;
      }

      List<Address> clusterNodeAddresses = ClusterExecutorUtil.getClusterNodeAddresses();
      List<ClusterNode> clusterNodes = clusterEvent.getClusterNodes();

      if ((clusterNodeAddresses.size() - clusterNodes.size()) > 1) {
        if (_log.isDebugEnabled()) {
          _log.debug("Number of original cluster members is greater than " + "one");
        }

        return;
      }

      long[] companyIds = PortalInstances.getCompanyIds();

      for (long companyId : companyIds) {
        loadIndexes(companyId);
      }

      loadIndexes(CompanyConstants.SYSTEM);
    }
  public void processClusterEvent(ClusterEvent clusterEvent) {
    List<ClusterNode> clusterNodes = clusterEvent.getClusterNodes();

    ClusterEventType clusterEventType = clusterEvent.getClusterEventType();

    if (clusterEventType.equals(ClusterEventType.DEPART)) {
      for (ClusterNode clusterNode : clusterNodes) {
        _processDepartEvent(clusterNode);
      }
    } else if (clusterEventType.equals(ClusterEventType.JOIN)) {
      for (ClusterNode clusterNode : clusterNodes) {
        _processJoinEvent(clusterNode);
      }
    }
  }