geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject incubator-geode git commit: GEODE-546: Resetting stats when AbstractGatewaySender is stopped
Date Fri, 13 Nov 2015 01:53:56 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-546 [created] 942006627


GEODE-546: Resetting stats when AbstractGatewaySender is stopped


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

Branch: refs/heads/feature/GEODE-546
Commit: 94200662711a77324752c4becbfd27e4ce9fd720
Parents: 781bd8d
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Thu Nov 12 13:50:11 2015 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Thu Nov 12 17:39:53 2015 -0800

----------------------------------------------------------------------
 .../cache/wan/AbstractGatewaySender.java        |  3 ++
 .../SerialAsyncEventQueueImplJUnitTest.java     | 46 ++++++++++++++++++++
 2 files changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/94200662/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
index ae1b523..bd19a71 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java
@@ -1100,6 +1100,9 @@ public abstract class AbstractGatewaySender implements GatewaySender,
       }
       this.enqueuedAllTempQueueEvents = false;
     }
+    
+    statistics.setQueueSize(0);
+    statistics.setTempQueueSize(0);
   }
   
   public Object getSubstituteValue(EntryEventImpl clonedEvent, EnumListenerEvent operation)
{

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/94200662/gemfire-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
new file mode 100644
index 0000000..2c4901c
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/asyncqueue/internal/SerialAsyncEventQueueImplJUnitTest.java
@@ -0,0 +1,46 @@
+package com.gemstone.gemfire.cache.asyncqueue.internal;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class SerialAsyncEventQueueImplJUnitTest {
+
+  private Cache cache;
+  @Before
+  public void setUp() {
+    CacheFactory cf = new CacheFactory().set("mcast-port", "0");
+    cache = cf.create();
+  }
+  
+  @After
+  public void tearDown() {
+    cache.close();
+  }
+  @Test
+  public void testStopClearsStats() {
+    GatewaySenderAttributes attrs = new GatewaySenderAttributes();
+    attrs.id = AsyncEventQueueImpl.ASYNC_EVENT_QUEUE_PREFIX + "id";
+    SerialAsyncEventQueueImpl queue = new SerialAsyncEventQueueImpl(cache, attrs);
+    queue.getStatistics().incQueueSize(5);
+    queue.getStatistics().incTempQueueSize(10);
+    
+    assertEquals(5, queue.getStatistics().getEventQueueSize());
+    assertEquals(10, queue.getStatistics().getTempEventQueueSize());
+   
+    queue.stop();
+    
+    assertEquals(0, queue.getStatistics().getEventQueueSize());
+    assertEquals(0, queue.getStatistics().getTempEventQueueSize());
+  }
+
+}


Mime
View raw message