示例#1
0
 @TopologyChanged
 @SuppressWarnings("unused")
 public void onTopologyChange(TopologyChangedEvent<?, ?> tce) {
   // don't do anything if this cache is not clustered
   if (clustered) {
     if (tce.isPre()) {
       currentTopologyId = tce.getNewTopologyId();
     } else {
       log.debugf("Topology changed, recalculating minTopologyId");
       calculateMinTopologyId(-1);
     }
   }
 }
示例#2
0
  protected final void recalculateMinTopologyIdIfNeeded(CacheTransaction removedTransaction) {
    if (removedTransaction == null)
      throw new IllegalArgumentException("Transaction cannot be null!");
    if (currentTopologyId != CACHE_STOPPED_TOPOLOGY_ID) {

      // Assume that we only get here if we are clustered.
      int removedTransactionTopologyId = removedTransaction.getTopologyId();
      if (removedTransactionTopologyId < minTxTopologyId) {
        log.tracef(
            "A transaction has a topology ID (%s) that is smaller than the smallest transaction topology ID (%s) this node knows about!  This can happen if a concurrent thread recalculates the minimum topology ID after the current transaction has been removed from the transaction table.",
            removedTransactionTopologyId, minTxTopologyId);
      } else if (removedTransactionTopologyId == minTxTopologyId
          && removedTransactionTopologyId < currentTopologyId) {
        // We should only need to re-calculate the minimum topology 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 topology ID.
        calculateMinTopologyId(removedTransactionTopologyId);
      }
    }
  }