From 81e1de95f8a6e9d4256e491086c1fc89e4bc1c75 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Thu, 29 Mar 2012 13:43:18 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-3473: add defensive null check for brokerservice and region broker in case of dup detection during initalisation or partially initialised test, pa is always eagerly created git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1306865 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/store/kahadb/KahaDBStore.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java index 1fe00acf67..192814041a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java @@ -287,11 +287,15 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter { @Override void rollbackStatsOnDuplicate(KahaDestination commandDestination) { - RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker(); - Set destinationSet = regionBroker.getDestinations(convert(commandDestination)); - for (Destination destination : destinationSet) { - destination.getDestinationStatistics().getMessages().decrement(); - destination.getDestinationStatistics().getEnqueues().decrement(); + if (brokerService != null) { + RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker(); + if (regionBroker != null) { + Set destinationSet = regionBroker.getDestinations(convert(commandDestination)); + for (Destination destination : destinationSet) { + destination.getDestinationStatistics().getMessages().decrement(); + destination.getDestinationStatistics().getEnqueues().decrement(); + } + } } }