コード例 #1
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);
   }
 }
コード例 #2
0
  protected final void recalculateMinViewIdIfNeeded(CacheTransaction removedTransaction) {
    if (removedTransaction == null)
      throw new IllegalArgumentException("Transaction cannot be null!");
    if (currentViewId != CACHE_STOPPED_VIEW_ID) {

      // Assume that we only get here if we are clustered.
      int removedTransactionViewId = removedTransaction.getViewId();
      if (removedTransactionViewId < minTxViewId) {
        log.tracef(
            "A transaction has a view ID (%s) that is smaller than the smallest transaction view ID (%s) this node knows about!  This can happen if a concurrent thread recalculates the minimum view ID after the current transaction has been removed from the transaction table.",
            removedTransactionViewId, minTxViewId);
      } else if (removedTransactionViewId == minTxViewId
          && removedTransactionViewId < currentViewId) {
        // We should only need to re-calculate the minimum view ID if the transaction being
        // completed
        // has the same ID as the smallest known transaction ID, to check what the new smallest is,
        // and this is
        // not the current view ID.
        calculateMinViewId(removedTransactionViewId);
      }
    }
  }