You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/05/10 21:11:06 UTC

[10/18] incubator-geode git commit: GEODE-1234: add a test hook to track client transactions scheduled to be removed.

GEODE-1234: add a test hook to track client transactions scheduled to be removed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0bf54254
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0bf54254
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0bf54254

Branch: refs/heads/feature/GEODE-1369
Commit: 0bf5425491a0ddbe0d614ab174be98957072f962
Parents: 3fe55d4
Author: eshu <es...@pivotal.io>
Authored: Mon May 9 16:36:59 2016 -0700
Committer: eshu <es...@pivotal.io>
Committed: Mon May 9 16:36:59 2016 -0700

----------------------------------------------------------------------
 .../cache/tier/sockets/ClientHealthMonitor.java       | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0bf54254/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientHealthMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientHealthMonitor.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientHealthMonitor.java
index 93e543d..c0f5021 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientHealthMonitor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientHealthMonitor.java
@@ -42,6 +42,7 @@ import com.gemstone.gemfire.internal.cache.IncomingGatewayStatus;
 import com.gemstone.gemfire.internal.cache.TXId;
 import com.gemstone.gemfire.internal.cache.TXManagerImpl;
 import com.gemstone.gemfire.internal.cache.tier.Acceptor;
+import com.gemstone.gemfire.internal.concurrent.ConcurrentHashSet;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;
@@ -278,6 +279,16 @@ public class ClientHealthMonitor {
       }
     }
   }
+  
+  private final Set<TXId> scheduledToBeRemovedTx = Boolean.getBoolean("gemfire.trackScheduledToBeRemovedTx")? 
+      new ConcurrentHashSet<TXId>() : null;
+
+  /**
+   * provide a test hook to track client transactions to be removed
+   */
+  public Set<TXId> getScheduledToBeRemovedTx() {
+    return scheduledToBeRemovedTx;
+  }
 
   /**
    * expire the transaction states for the given client.  This uses the
@@ -298,13 +309,16 @@ public class ClientHealthMonitor {
       if (logger.isDebugEnabled()) {
         logger.debug("expiring {} transaction contexts for {} timeout={}", txids.size(), proxyID, timeout/1000);
       }
+
       if (timeout <= 0) {
         txMgr.removeTransactions(txids, true);
       } else {
+        if (scheduledToBeRemovedTx != null) scheduledToBeRemovedTx.addAll(txids);       
         SystemTimerTask task = new SystemTimerTask() {
           @Override
           public void run2() {
             txMgr.removeTransactions(txids, true);
+            if (scheduledToBeRemovedTx != null) scheduledToBeRemovedTx.removeAll(txids);
           }
         };
         ((GemFireCacheImpl)this._cache).getCCPTimer().schedule(task, timeout);