diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouter.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouter.java index fed0bc0a80..9d72862983 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouter.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouter.java @@ -176,7 +176,7 @@ public class ConnectionRouter implements ActiveMQComponent { return localTarget; } - if (pool == null) { + if (policy == null || pool == null) { return TargetResult.REFUSED_USE_ANOTHER_RESULT; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouterManager.java index 86aea1dc32..66b9de4440 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouterManager.java @@ -186,7 +186,7 @@ public final class ConnectionRouterManager implements ActiveMQComponent { policy.init(policyConfig.getProperties()); - if (policy.getTargetProbe() != null) { + if (pool != null && policy.getTargetProbe() != null) { pool.addTargetProbe(policy.getTargetProbe()); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/caches/LocalCache.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/caches/LocalCache.java index 3831948790..7fb320382f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/caches/LocalCache.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/caches/LocalCache.java @@ -71,9 +71,11 @@ public class LocalCache implements Cache, RemovalListener { if (persisted) { persistedCacheEntries = storageManager.getPersistedKeyValuePairs(id); - for (Map.Entry cacheEntry : persistedCacheEntries.entrySet()) { - cache.put(cacheEntry.getKey(), cacheEntry.getValue().getValue()); - logger.info(cacheEntry.toString()); + if (persistedCacheEntries != null) { + for (Map.Entry cacheEntry : persistedCacheEntries.entrySet()) { + cache.put(cacheEntry.getKey(), cacheEntry.getValue().getValue()); + logger.info(cacheEntry.toString()); + } } }