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
This commit is contained in:
Gary Tully 2012-03-29 13:43:18 +00:00
parent b137af4f8a
commit 81e1de95f8
1 changed files with 9 additions and 5 deletions

View File

@ -287,11 +287,15 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
@Override
void rollbackStatsOnDuplicate(KahaDestination commandDestination) {
RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
Set<Destination> 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<Destination> destinationSet = regionBroker.getDestinations(convert(commandDestination));
for (Destination destination : destinationSet) {
destination.getDestinationStatistics().getMessages().decrement();
destination.getDestinationStatistics().getEnqueues().decrement();
}
}
}
}