geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject geode git commit: GEODE-2632: prevent ClassCastException from ConnectionCountProbe to Identifiable
Date Mon, 01 May 2017 17:21:48 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 8da1ba353 -> 73db6e376


GEODE-2632: prevent ClassCastException from ConnectionCountProbe to Identifiable


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

Branch: refs/heads/develop
Commit: 73db6e376696fdc9dd17a5f9df78c80545b5a60a
Parents: 8da1ba3
Author: Kirk Lund <klund@apache.org>
Authored: Fri Apr 28 10:55:55 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Mon May 1 10:08:33 2017 -0700

----------------------------------------------------------------------
 .../geode/internal/cache/GemFireCacheImpl.java  | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/73db6e37/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index f3510da..b634b66 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -67,6 +67,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiPredicate;
+import java.util.function.Supplier;
 import java.util.regex.Pattern;
 
 import javax.naming.Context;
@@ -5088,12 +5090,18 @@ public class GemFireCacheImpl
 
         Declarable matchingDeclarable = null;
         for (Entry<Declarable, Properties> oldEntry : this.declarablePropertiesMap.entrySet())
{
-          boolean isKeyClassSame = clazz.getName().equals(oldEntry.getKey().getClass().getName());
-          boolean isValueEqual = newEntry.getValue().equals(oldEntry.getValue());
-          boolean isKeyIdentifiableAndSameId =
-              Identifiable.class.isInstance(newEntry.getKey()) && ((Identifiable)
oldEntry.getKey())
-                  .getId().equals(((Identifiable) newEntry.getKey()).getId());
-          if (isKeyClassSame && (isValueEqual || isKeyIdentifiableAndSameId)) {
+
+          BiPredicate<Declarable, Declarable> isKeyIdentifiableAndSameIdPredicate =
+              (Declarable oldKey, Declarable newKey) -> Identifiable.class.isInstance(newKey)
+                  && ((Identifiable) oldKey).getId().equals(((Identifiable) newKey).getId());
+
+          Supplier<Boolean> isKeyClassSame =
+              () -> clazz.getName().equals(oldEntry.getKey().getClass().getName());
+          Supplier<Boolean> isValueEqual = () -> newEntry.getValue().equals(oldEntry.getValue());
+          Supplier<Boolean> isKeyIdentifiableAndSameId =
+              () -> isKeyIdentifiableAndSameIdPredicate.test(oldEntry.getKey(), newEntry.getKey());
+
+          if (isKeyClassSame.get() && (isValueEqual.get() || isKeyIdentifiableAndSameId.get()))
{
             matchingDeclarable = oldEntry.getKey();
             break;
           }


Mime
View raw message