Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 835DD186D0 for ; Mon, 14 Dec 2015 16:32:28 +0000 (UTC) Received: (qmail 1996 invoked by uid 500); 14 Dec 2015 16:32:28 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 1955 invoked by uid 500); 14 Dec 2015 16:32:28 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 1946 invoked by uid 99); 14 Dec 2015 16:32:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Dec 2015 16:32:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 191B5E0667; Mon, 14 Dec 2015 16:32:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gtully@apache.org To: commits@activemq.apache.org Message-Id: <5cd842ea7bfc49dfb24943980d597b5b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: 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 16:32:28 +0000 (UTC) Repository: activemq Updated Branches: refs/heads/master 35df815fb -> 455a62830 https://issues.apache.org/jira/browse/AMQ-6086 - avoid logging npe on attempted start of persistence adapter post stop Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/455a6283 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/455a6283 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/455a6283 Branch: refs/heads/master Commit: 455a628305dc49476d7033701901d119db3fffdb Parents: 35df815 Author: gtully Authored: Mon Dec 14 16:32:10 2015 +0000 Committer: gtully Committed: Mon Dec 14 16:32:10 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/455a6283/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/455a6283/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);