geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [3/9] incubator-geode git commit: GEODE-1984: Making public GateWaySender API 'destroy'
Date Fri, 25 Nov 2016 15:17:50 GMT
GEODE-1984: Making public GateWaySender API 'destroy'


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

Branch: refs/heads/feature/GEODE-1984
Commit: 6af49b5e4e0fef85fa31cf9f9af539773baf7178
Parents: f452177
Author: adongre <adongre@apache.org>
Authored: Sat Nov 19 16:04:53 2016 +0530
Committer: adongre <adongre@apache.org>
Committed: Sat Nov 19 16:04:53 2016 +0530

----------------------------------------------------------------------
 .../asyncqueue/internal/AsyncEventQueueImpl.java      |  2 +-
 .../org/apache/geode/cache/wan/GatewaySender.java     | 14 ++++++++++++++
 .../internal/cache/wan/AbstractGatewaySender.java     |  1 +
 .../apache/geode/internal/cache/wan/WANTestBase.java  |  2 +-
 4 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6af49b5e/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
index a5f0497..2eb53be 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/asyncqueue/internal/AsyncEventQueueImpl.java
@@ -191,7 +191,7 @@ public class AsyncEventQueueImpl implements AsyncEventQueue {
   }
 
   public void destroy() {
-    ((AbstractGatewaySender) this.sender).destroy();
+    this.sender.destroy();
   }
 
   public boolean isBucketSorted() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6af49b5e/geode-core/src/main/java/org/apache/geode/cache/wan/GatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/wan/GatewaySender.java b/geode-core/src/main/java/org/apache/geode/cache/wan/GatewaySender.java
index d950ef3..ad5ef3d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/wan/GatewaySender.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/wan/GatewaySender.java
@@ -400,4 +400,18 @@ public interface GatewaySender {
 
   public int getMaxParallelismForReplicatedRegion();
 
+
+  /**
+   * Destroys the GatewaySender. Before destroying the sender, caller needs to to ensure
that the
+   * sender is stopped so that all the resources (threads, connection pool etc.) will be
released
+   * properly. Stopping the sender is not handled in the destroy. Destroy is carried out
in
+   * following steps: 1. Take the lifeCycleLock. 2. If the sender is attached to any application
+   * region, throw an exception. 3. Close the GatewaySenderAdvisor. 4. Remove the sender
from the
+   * cache. 5. Destroy the region underlying the GatewaySender.
+   *
+   * In case of ParallelGatewaySender, the destroy operation does distributed destroy of
the QPR. In
+   * case of SerialGatewaySender, the queue region is destroyed locally.
+   */
+  public void destroy();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6af49b5e/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
index e1c9010..c4d503e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/AbstractGatewaySender.java
@@ -510,6 +510,7 @@ public abstract class AbstractGatewaySender implements GatewaySender,
Distributi
    * In case of ParallelGatewaySender, the destroy operation does distributed destroy of
the QPR. In
    * case of SerialGatewaySender, the queue region is destroyed locally.
    */
+  @Override
   public void destroy() {
     try {
       this.getLifeCycleLock().writeLock().lock();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6af49b5e/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
index f9c18ec..adac74c 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
@@ -3394,7 +3394,7 @@ public class WANTestBase extends JUnit4DistributedTestCase {
         break;
       }
     }
-    ((AbstractGatewaySender) sender).destroy();
+    sender.destroy();
   }
 
   public static void verifySenderDestroyed(String senderId, boolean isParallel) {


Mime
View raw message