This is an automated email from the ASF dual-hosted git repository.

pivotalsarge pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 5252419  GEODE-4511: Ensure a pool is available for durable client 
subscription. (#1448)
5252419 is described below

commit 525241905050e9a192a1f36fc662735ab8e281d9
Author: Michael "Sarge" Dodge <mdo...@pivotal.io>
AuthorDate: Wed Feb 14 09:03:03 2018 -0800

    GEODE-4511: Ensure a pool is available for durable client subscription. 
(#1448)
    
    * GEODE-4511: Ensure a pool is available for durable client subscription.
    
    * GEODE-4511: Restrict default pool creation for subscription to clients.
---
 .../org/apache/geode/internal/cache/GemFireCacheImpl.java    | 12 ++++++++++++
 .../org/apache/geode/internal/cache/PoolManagerImpl.java     |  3 ---
 .../cache/tier/sockets/RegisterInterestIntegrationTest.java  | 11 +++--------
 3 files changed, 15 insertions(+), 11 deletions(-)

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 a441ffb..1549cd9 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
@@ -4329,6 +4329,18 @@ public class GemFireCacheImpl implements InternalCache, 
InternalClientCache, Has
 
   @Override
   public void readyForEvents() {
+    if (isClient()) {
+      // If a durable client has been configured...
+      if (Objects.nonNull(system) && Objects.nonNull(system.getConfig())
+          && !Objects.equals(DistributionConfig.DEFAULT_DURABLE_CLIENT_ID,
+              Objects.toString(system.getConfig().getDurableClientId(),
+                  DistributionConfig.DEFAULT_DURABLE_CLIENT_ID))) {
+        // Ensure that there is a pool to use for readyForEvents().
+        if (Objects.isNull(defaultPool)) {
+          determineDefaultPool();
+        }
+      }
+    }
     PoolManagerImpl.readyForEvents(this.system, false);
   }
 
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java 
b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java
index ffc62ea..82f3178 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java
@@ -206,9 +206,6 @@ public class PoolManagerImpl {
         }
       }
     }
-    if (pools.size() == 0) {
-      throw new IllegalStateException("Ready for Events called, but no pool to 
execute on");
-    }
     if (pools.size() > 0 && !foundDurablePool) {
       throw new IllegalStateException(
           
LocalizedStrings.PoolManagerImpl_ONLY_DURABLE_CLIENTS_SHOULD_CALL_READYFOREVENTS
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RegisterInterestIntegrationTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RegisterInterestIntegrationTest.java
index d234c96..e10dc0a 100644
--- 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RegisterInterestIntegrationTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/RegisterInterestIntegrationTest.java
@@ -300,18 +300,13 @@ public class RegisterInterestIntegrationTest {
   }
 
   @Test
-  public void 
readyForEventsBeforeAnyPoolsAreCreatedShouldResultInIllegalStateException()
+  public void 
readyForEventsBeforeAnyPoolsAreCreatedShouldNotResultInIllegalStateException()
       throws Exception {
 
     ClientCache clientCache = createClientCache(locatorPort, true);
 
-    try {
-      clientCache.readyForEvents();
-      fail();
-    } catch (IllegalStateException e) {
-      assertEquals("Ready for Events called, but no pool to execute on", 
e.getMessage());
-    }
-
+    clientCache.readyForEvents();
+    // No exception should be thrown.
   }
 
   private ClientCache createClientCache(Integer locatorPort) {

-- 
To stop receiving notification emails like this one, please contact
pivotalsa...@apache.org.

Reply via email to