You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2016/12/21 20:37:47 UTC

geode git commit: GEODE-2215: GatewaySenderAdvisor checks the current processor to see if it has started

Repository: geode
Updated Branches:
  refs/heads/develop 225066b48 -> 164f04fbd


GEODE-2215: GatewaySenderAdvisor checks the current processor to see if it has started

  * Previously it was checking the top level sender (possibly a concurrent sendor)
  * This allowed a race condition where the top level sender was still starting up
  * but the individual processors were ready to process.  They would check the flag
  * and because the sender was not ready, the processors would act and start initiating
  * failover, which left the processor in a very weird state


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

Branch: refs/heads/develop
Commit: 164f04fbd85f20de6c7f9edef267d3f48463a954
Parents: 225066b
Author: Jason Huynh <hu...@gmail.com>
Authored: Fri Dec 9 15:28:23 2016 -0800
Committer: Jason Huynh <hu...@gmail.com>
Committed: Wed Dec 21 12:35:51 2016 -0800

----------------------------------------------------------------------
 .../apache/geode/internal/cache/wan/GatewaySenderAdvisor.java   | 5 +++--
 .../cache/wan/serial/SerialGatewaySenderEventProcessor.java     | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/164f04fb/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
index ace780e..baa9d9c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java
@@ -475,7 +475,8 @@ public class GatewaySenderAdvisor extends DistributionAdvisor {
     this.lockObtainingThread.start();
   }
 
-  public void waitToBecomePrimary() throws InterruptedException {
+  public void waitToBecomePrimary(AbstractGatewaySenderEventProcessor callingProcessor)
+      throws InterruptedException {
     if (isPrimary()) {
       return;
     }
@@ -484,7 +485,7 @@ public class GatewaySenderAdvisor extends DistributionAdvisor {
           LocalizedStrings.GatewayImpl_0__WAITING_TO_BECOME_PRIMARY_GATEWAY, this.sender.getId()));
       while (!isPrimary()) {
         this.primaryLock.wait(1000);
-        if (sender.getEventProcessor() != null && sender.getEventProcessor().isStopped()) {
+        if (sender.getEventProcessor() != null && callingProcessor.isStopped()) {
           logger.info("The event processor is stopped, not to wait for being primary any more.");
           return;
         }

http://git-wip-us.apache.org/repos/asf/geode/blob/164f04fb/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventProcessor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventProcessor.java
index 9755adb..0aa0ed9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventProcessor.java
@@ -143,7 +143,7 @@ public class SerialGatewaySenderEventProcessor extends AbstractGatewaySenderEven
   protected boolean waitForPrimary() {
 
     try {
-      this.sender.getSenderAdvisor().waitToBecomePrimary();
+      this.sender.getSenderAdvisor().waitToBecomePrimary(this);
     } catch (InterruptedException e) {
       // No need to set the interrupt bit, we're exiting the thread.
       if (!stopped()) {