From 5a483f922a63729f4d16904c6ea4f985c9a49b41 Mon Sep 17 00:00:00 2001 From: jbertram Date: Thu, 4 Feb 2016 14:20:02 -0600 Subject: [PATCH] ARTEMIS-376 NPE during fail-back --- .../impl/SharedNothingLiveActivation.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java index 299df00ef6..76730a0ccb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java @@ -51,6 +51,7 @@ import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import java.util.List; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; public class SharedNothingLiveActivation extends LiveActivation { @@ -229,17 +230,20 @@ public class SharedNothingLiveActivation extends LiveActivation { @Override public void connectionClosed() { - activeMQServer.getThreadPool().execute(new Runnable() { - @Override - public void run() { - synchronized (replicationLock) { - if (replicationManager != null) { - activeMQServer.getStorageManager().stopReplication(); - replicationManager = null; + ExecutorService executorService = activeMQServer.getThreadPool(); + if (executorService != null) { + executorService.execute(new Runnable() { + @Override + public void run() { + synchronized (replicationLock) { + if (replicationManager != null) { + activeMQServer.getStorageManager().stopReplication(); + replicationManager = null; + } } } - } - }); + }); + } } }