You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2020/09/24 14:27:09 UTC
[activemq-artemis] 02/03: ARTEMIS-2912 Handle NPE due to
uninitialized members
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 69fa4f3e93675dbe6458de8f4c58cce56bea64c5
Author: franz1981 <ni...@gmail.com>
AuthorDate: Thu Sep 24 01:36:01 2020 +0200
ARTEMIS-2912 Handle NPE due to uninitialized members
---
.../core/server/impl/ActiveMQServerImpl.java | 41 ++++++++++++++++------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 46ba027..1c574e1 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -1089,17 +1089,24 @@ public class ActiveMQServerImpl implements ActiveMQServer {
state = SERVER_STATE.STOPPING;
if (criticalIOError) {
- // notifications trigger disk IO so we don't want to send any on a critical IO error
- managementService.enableNotifications(false);
+ final ManagementService managementService = this.managementService;
+ if (managementService != null) {
+ // notifications trigger disk IO so we don't want to send any on a critical IO error
+ managementService.enableNotifications(false);
+ }
}
+ final FileStoreMonitor fileStoreMonitor = this.fileStoreMonitor;
if (fileStoreMonitor != null) {
fileStoreMonitor.stop();
- fileStoreMonitor = null;
+ this.fileStoreMonitor = null;
}
if (failoverOnServerShutdown) {
- activation.sendLiveIsStopping();
+ final Activation activation = this.activation;
+ if (activation != null) {
+ activation.sendLiveIsStopping();
+ }
}
stopComponent(connectorsService);
@@ -1113,6 +1120,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
stopComponent(federationManager);
stopComponent(clusterManager);
+ final RemotingService remotingService = this.remotingService;
if (remotingService != null) {
remotingService.pauseAcceptors();
}
@@ -1134,7 +1142,10 @@ public class ActiveMQServerImpl implements ActiveMQServer {
freezeConnections();
}
- activation.postConnectionFreeze();
+ final Activation activation = this.activation;
+ if (activation != null) {
+ activation.postConnectionFreeze();
+ }
closeAllServerSessions(criticalIOError);
@@ -1147,6 +1158,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
//
// *************************************************************************************************************
+ final StorageManager storageManager = this.storageManager;
if (storageManager != null)
storageManager.clearContext();
@@ -1155,10 +1167,12 @@ public class ActiveMQServerImpl implements ActiveMQServer {
stopComponent(backupManager);
- try {
- activation.preStorageClose();
- } catch (Throwable t) {
- ActiveMQServerLogger.LOGGER.errorStoppingComponent(t, activation.getClass().getName());
+ if (activation != null) {
+ try {
+ activation.preStorageClose();
+ } catch (Throwable t) {
+ ActiveMQServerLogger.LOGGER.errorStoppingComponent(t, activation.getClass().getName());
+ }
}
stopComponent(pagingManager);
@@ -1172,6 +1186,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
// We stop remotingService before otherwise we may lock the system in case of a critical IO
// error shutdown
+ final RemotingService remotingService = this.remotingService;
if (remotingService != null)
try {
remotingService.stop(criticalIOError);
@@ -1180,6 +1195,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
}
// Stop the management service after the remoting service to ensure all acceptors are deregistered with JMX
+ final ManagementService managementService = this.managementService;
if (managementService != null)
try {
managementService.unregisterServer();
@@ -1232,7 +1248,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
messagingServerControl = null;
memoryManager = null;
backupManager = null;
- storageManager = null;
+ this.storageManager = null;
sessions.clear();
@@ -1330,7 +1346,10 @@ public class ActiveMQServerImpl implements ActiveMQServer {
* {@link #stop(boolean, boolean, boolean)}.
*/
private void freezeConnections() {
- activation.freezeConnections(remotingService);
+ Activation activation = this.activation;
+ if (activation != null) {
+ activation.freezeConnections(remotingService);
+ }
// after disconnecting all the clients close all the server sessions so any messages in delivery will be cancelled back to the queue
for (ServerSession serverSession : sessions.values()) {