You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ma...@apache.org on 2015/11/23 21:48:56 UTC
[26/50] [abbrv] incubator-geode git commit: GEODE-546: Resetting
stats when AbstractGatewaySender is stopped
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/5a0d43e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5a0d43e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5a0d43e3
Branch: refs/heads/feature/GEODE-53
Commit: 5a0d43e3f1b96b6360fc7d35e211923598cc37b4
Parents: 8703abc
Author: Dan Smith <up...@apache.org>
Authored: Thu Nov 12 13:50:11 2015 -0800
Committer: Dan Smith <up...@apache.org>
Committed: Fri Nov 13 13:14:12 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/5a0d43e3/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/5a0d43e3/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..594a98f
--- /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.IntegrationTest;
+
+@Category(IntegrationTest.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());
+ }
+
+}