You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2016/12/27 23:01:32 UTC

geode git commit: Code cleanup

Repository: geode
Updated Branches:
  refs/heads/develop a76aaf0c0 -> 6992fcf34


Code cleanup

See https://reviews.apache.org/r/55017/

While investigating a couple of failures I ran across a few things
that needed to be fixed.

1. EndpointManagerImpl was skipping notification of listeners if there
was no member ID in an endpoint but the member ID is no longer used.
I removed the check.

2. During a Forced Disconnect CacheClientProxy was skipping a lot of
clean-up because it was expecting a CacheClosedException instead of
a CancelException. We should never catch CacheClosedException -
always catch CancelException.

3. When SSL is being used the P2P Reader Threads were not setting connection
attributes in the thread's name like we do with non-SSL reader threads.
This made debugging an SSL failure a bit more difficult.


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

Branch: refs/heads/develop
Commit: 6992fcf3438f0d5de246579400bdf8f44928429e
Parents: a76aaf0
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Tue Dec 27 14:59:31 2016 -0800
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Tue Dec 27 14:59:31 2016 -0800

----------------------------------------------------------------------
 .../client/internal/EndpointManagerImpl.java    |  4 ++--
 .../cache/tier/sockets/CacheClientProxy.java    |  4 ++--
 .../apache/geode/internal/tcp/Connection.java   | 22 ++++++++++++--------
 3 files changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/6992fcf3/geode-core/src/main/java/org/apache/geode/cache/client/internal/EndpointManagerImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/EndpointManagerImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/EndpointManagerImpl.java
index 6d5d9d6..f05815f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/EndpointManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/EndpointManagerImpl.java
@@ -314,7 +314,7 @@ public class EndpointManagerImpl implements EndpointManager {
   public class EndpointListenerForBridgeMembership implements EndpointManager.EndpointListener {
 
     public void endpointCrashed(Endpoint endpoint) {
-      if (endpoint.getMemberId() == null || cancelCriterion.isCancelInProgress()) {
+      if (cancelCriterion.isCancelInProgress()) {
         return;
       }
       // logger.warn("EMANFIRE:CRASH:"+endpoint.getLocation());
@@ -322,7 +322,7 @@ public class EndpointManagerImpl implements EndpointManager {
     }
 
     public void endpointNoLongerInUse(Endpoint endpoint) {
-      if (endpoint.getMemberId() == null || cancelCriterion.isCancelInProgress()) {
+      if (cancelCriterion.isCancelInProgress()) {
         return;
       }
       // logger.warn("EMANFIRE:LEFT:"+endpoint.getLocation());

http://git-wip-us.apache.org/repos/asf/geode/blob/6992fcf3/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index 6e31fe5..562c0ef 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -1014,7 +1014,7 @@ public class CacheClientProxy implements ClientSession {
     }
     try {
       this.cils[RegisterInterestTracker.interestListIndex].clearClientInterestList();
-    } catch (CacheClosedException e) {
+    } catch (CancelException e) {
       // ignore if cache is shutting down
     }
     // Commented to fix bug 40259
@@ -2056,7 +2056,7 @@ public class CacheClientProxy implements ClientSession {
     protected FilterProfile getProfile(String regionName) {
       try {
         return this.ccp._cache.getFilterProfile(regionName);
-      } catch (CacheClosedException e) {
+      } catch (CancelException e) {
         return null;
       }
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/6992fcf3/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index d44476f..ca5cce1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -2363,6 +2363,7 @@ public class Connection implements Runnable {
                 }
                 dominoCount.set(dominoNumber);
                 // this.senderName = dis.readUTF();
+                setThreadName(dominoNumber);
               }
 
               if (!this.sharedResource) {
@@ -3908,15 +3909,7 @@ public class Connection implements Runnable {
                 // if (name == null) {
                 // name = "pid="+OSProcess.getId();
                 // }
-                Thread.currentThread().setName(
-                    // (!this.sharedResource && this.senderName != null? ("<"+this.senderName+"> ->
-                    // ") : "") +
-                    // "[" + name + "] "+
-                    "P2P message reader for " + this.remoteAddr + " "
-                        + (this.sharedResource ? "" : "un") + "shared" + " "
-                        + (this.preserveOrder ? "" : "un") + "ordered" + " uid=" + this.uniqueId
-                        + (dominoNumber > 0 ? (" dom #" + dominoNumber) : "") + " port="
-                        + this.socket.getPort());
+                setThreadName(dominoNumber);
               } catch (Exception e) {
                 this.owner.getConduit().getCancelCriterion().checkCancelInProgress(e); // bug 37101
                 logger.fatal(LocalizedMessage.create(
@@ -3990,6 +3983,17 @@ public class Connection implements Runnable {
     }
   }
 
+  private void setThreadName(int dominoNumber) {
+    Thread.currentThread().setName(
+        // (!this.sharedResource && this.senderName != null? ("<"+this.senderName+"> ->
+        // ") : "") +
+        // "[" + name + "] "+
+        "P2P message reader for " + this.remoteAddr + " " + (this.sharedResource ? "" : "un")
+            + "shared" + " " + (this.preserveOrder ? "" : "un") + "ordered" + " uid="
+            + this.uniqueId + (dominoNumber > 0 ? (" dom #" + dominoNumber) : "") + " port="
+            + this.socket.getPort());
+  }
+
   private void compactOrResizeBuffer(int messageLength) {
     final int oldBufferSize = nioInputBuffer.capacity();
     final DMStats stats = this.owner.getConduit().stats;