Ejemplo n.º 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);
      }
    }
  }
Ejemplo n.º 3
0
  protected boolean memberJoined(Address joinAddress, ClusterNode clusterNode) {

    _liveInstances.put(joinAddress, clusterNode);

    Address previousAddress =
        _clusterNodeAddresses.put(clusterNode.getClusterNodeId(), joinAddress);

    if (previousAddress != null) {
      return false;
    }

    ClusterEvent clusterEvent = ClusterEvent.join(clusterNode);

    fireClusterEvent(clusterEvent);

    return true;
  }
Ejemplo n.º 4
0
  protected void memberRemoved(List<Address> departAddresses) {
    List<ClusterNode> departClusterNodes = new ArrayList<>();

    for (Address departAddress : departAddresses) {
      ClusterNode departClusterNode = _liveInstances.remove(departAddress);

      if (departClusterNode == null) {
        continue;
      }

      departClusterNodes.add(departClusterNode);

      _clusterNodeAddresses.remove(departClusterNode.getClusterNodeId());
    }

    if (departClusterNodes.isEmpty()) {
      return;
    }

    ClusterEvent clusterEvent = ClusterEvent.depart(departClusterNodes);

    fireClusterEvent(clusterEvent);
  }
 protected void processClusterEvent() {
   _replicasClusterListener.processClusterEvent(ClusterEvent.join());
 }