You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/10/24 18:17:37 UTC

[52/55] [abbrv] incubator-geode git commit: GEODE-2011 Client code which clears pdx registry needs synchronization

GEODE-2011 Client code which clears pdx registry needs synchronization

We clear pdx registry in client when we re-connect to cluster. But
during that time other thread may end up using old registry while other
thread is clearing this. Thus we need to synchronize that. In current
code it happens through listener events and I modified that notification
to synchronize this.


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

Branch: refs/heads/feature/GEODE-1985
Commit: 6eb0fd398e9bff7798939df6781aa52979ef9693
Parents: 8bf3957
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Fri Oct 21 15:52:00 2016 -0700
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Fri Oct 21 15:52:00 2016 -0700

----------------------------------------------------------------------
 .../cache/client/internal/EndpointManagerImpl.java   | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6eb0fd39/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 f594278..ec8a818 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
@@ -77,6 +77,7 @@ public class EndpointManagerImpl implements EndpointManager {
           Map<ServerLocation, Endpoint> endpointMapTemp =
               new HashMap<ServerLocation, Endpoint>(endpointMap);
           endpoint = new Endpoint(this, ds, server, stats, memberId);
+          listener.clearPdxRegistry(endpoint);
           endpointMapTemp.put(server, endpoint);
           endpointMap = Collections.unmodifiableMap(endpointMapTemp);
           addedEndpoint = true;
@@ -291,9 +292,21 @@ public class EndpointManagerImpl implements EndpointManager {
       // logger.warn("HIGHUP:JOIN:"+endpoint.getLocation());
       for (Iterator<EndpointListener> itr = endpointListeners.iterator(); itr.hasNext();) {
         EndpointManager.EndpointListener listener = itr.next();
-        listener.endpointNowInUse(endpoint);
+        if (!(listener instanceof PdxRegistryRecoveryListener)) {
+          listener.endpointNowInUse(endpoint);
+        }
+      }
+    }
+
+    public void clearPdxRegistry(Endpoint endpoint) {
+      for (Iterator<EndpointListener> itr = endpointListeners.iterator(); itr.hasNext();) {
+        EndpointManager.EndpointListener listener = itr.next();
+        if (listener instanceof PdxRegistryRecoveryListener) {
+          listener.endpointNowInUse(endpoint);
+        }
       }
     }
+
   }