コード例 #1
0
    @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);
    }
コード例 #2
0
 @ViewChanged
 public void recalculateMinViewIdOnTopologyChange(ViewChangedEvent vce) {
   // don't do anything if this cache is not clustered - view changes are global
   if (clustered) {
     log.debugf("View changed, recalculating minViewId");
     currentViewId = vce.getViewId();
     calculateMinViewId(-1);
   }
 }
コード例 #3
0
 @ViewChanged
 @SuppressWarnings("unused")
 public void calculateRank(ViewChangedEvent e) {
   long rank =
       NumericVersionGenerator.this.calculateRank(
           e.getLocalAddress(), e.getNewMembers(), e.getViewId());
   if (log.isTraceEnabled())
     log.tracef("Calculated rank based on view %s and result was %d", e, rank);
 }