@Merged
    @ViewChanged
    public void handleViewChange(ViewChangedEvent e) {
      if (trace)
        log.tracef(
            "New view received: %d, type=%s, members: %s. Starting the RebalanceTask",
            e.getViewId(), e.getType(), e.getNewMembers());

      boolean rehashInterrupted = rehashInProgress;
      synchronized (rehashInProgressMonitor) {
        rehashInProgress = true;
        receivedRehashCompletedNotification = false;
        lastViewId = e.getViewId();
        rehashInProgressMonitor.notifyAll();
      }

      // make sure the pushConfirmations map has one entry for each cluster member
      // we will always have
      if (DistributionManagerImpl.this.getRpcManager().getTransport().isCoordinator()) {
        synchronized (pushConfirmations) {
          for (Address newNode : e.getNewMembers()) {
            if (!pushConfirmations.containsKey(newNode)) {
              if (trace) log.tracef("Coordinator: adding new node %s", newNode);
              pushConfirmations.put(newNode, -1);
            }
          }
          for (Address oldNode : e.getOldMembers()) {
            if (!e.getNewMembers().contains(oldNode)) {
              if (trace) log.tracef("Coordinator: removing node %s", oldNode);
              pushConfirmations.remove(oldNode);
            }
          }
          if (trace)
            log.tracef("Coordinator: push confirmations list updated: %s", pushConfirmations);
        }
      }

      RebalanceTask rebalanceTask =
          new RebalanceTask(
              rpcManager,
              cf,
              configuration,
              dataContainer,
              DistributionManagerImpl.this,
              icc,
              cacheNotifier,
              interceptorChain,
              e.getViewId(),
              rehashInterrupted);
      rehashExecutor.submit(rebalanceTask);
    }
Exemplo n.º 2
0
 @ViewChanged
 public void viewChanged(ViewChangedEvent e) {
   Debug.line('x', e.getOldMembers(), e.getNewMembers());
 }