activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject [2/5] activemq git commit: https://issues.apache.org/jira/browse/AMQ-6086 - avoid logging npe on attempted start of persistence adapter post stop
Date Mon, 14 Dec 2015 19:09:42 GMT
https://issues.apache.org/jira/browse/AMQ-6086 - avoid logging npe on attempted start of persistence
adapter post stop

(cherry picked from commit 455a628305dc49476d7033701901d119db3fffdb)


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

Branch: refs/heads/activemq-5.13.x
Commit: b4360c6e0e285aa97851d5bda9083d376709b0b4
Parents: 2ffd749
Author: gtully <gary.tully@gmail.com>
Authored: Mon Dec 14 16:32:10 2015 +0000
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Mon Dec 14 19:09:15 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/activemq/broker/BrokerService.java | 13 +++++++++----
 .../usecases/StartAndConcurrentStopBrokerTest.java     |  3 +++
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/b4360c6e/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
index d028078..cef2520 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -658,13 +658,18 @@ public class BrokerService implements Service {
     }
 
     private void doStartPersistenceAdapter() throws Exception {
-        getPersistenceAdapter().setUsageManager(getProducerSystemUsage());
-        getPersistenceAdapter().setBrokerName(getBrokerName());
-        LOG.info("Using Persistence Adapter: {}", getPersistenceAdapter());
+        PersistenceAdapter persistenceAdapterToStart = getPersistenceAdapter();
+        if (persistenceAdapterToStart == null) {
+            checkStartException();
+            throw new ConfigurationException("Cannot start null persistence adapter");
+        }
+        persistenceAdapterToStart.setUsageManager(getProducerSystemUsage());
+        persistenceAdapterToStart.setBrokerName(getBrokerName());
+        LOG.info("Using Persistence Adapter: {}", persistenceAdapterToStart);
         if (deleteAllMessagesOnStartup) {
             deleteAllMessages();
         }
-        getPersistenceAdapter().start();
+        persistenceAdapterToStart.start();
 
         getTempDataStore();
         if (tempDataStore != null) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/b4360c6e/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndConcurrentStopBrokerTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndConcurrentStopBrokerTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndConcurrentStopBrokerTest.java
index 4d194ca..8ea0af8 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndConcurrentStopBrokerTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/StartAndConcurrentStopBrokerTest.java
@@ -46,6 +46,7 @@ import javax.management.OperationsException;
 import javax.management.QueryExp;
 import javax.management.ReflectionException;
 import javax.management.loading.ClassLoaderRepository;
+import org.apache.activemq.ConfigurationException;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.BrokerStoppedException;
 import org.junit.Test;
@@ -286,6 +287,7 @@ public class StartAndConcurrentStopBrokerTest {
                     broker.getManagementContext().setMBeanServer(mBeanServer);
                     broker.start();
                 } catch (BrokerStoppedException expected) {
+                } catch (ConfigurationException expected) {
                 } catch (Exception e) {
                     e.printStackTrace();
                     error.set(e);
@@ -330,6 +332,7 @@ public class StartAndConcurrentStopBrokerTest {
                     brokerTwo.getManagementContext().setMBeanServer(mBeanServer);
                     brokerTwo.start();
                 } catch (BrokerStoppedException expected) {
+                } catch (ConfigurationException expected) {
                 } catch (Exception e) {
                     e.printStackTrace();
                     error.set(e);


Mime
View raw message