From debd0cc241d5af9613d3b032793410017411b6fb Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Mon, 13 Feb 2006 16:31:37 +0000 Subject: [PATCH] Added getDurableDestinations() to Broker - to make accessable for NetworkConnectors git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@377412 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/activemq/broker/Broker.java | 6 ++++++ .../java/org/apache/activemq/broker/BrokerFilter.java | 5 +++++ .../main/java/org/apache/activemq/broker/EmptyBroker.java | 5 +++++ .../main/java/org/apache/activemq/broker/ErrorBroker.java | 5 +++++ .../org/apache/activemq/broker/MutableBrokerFilter.java | 5 +++++ .../org/apache/activemq/broker/region/RegionBroker.java | 8 +++++++- 6 files changed, 33 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java b/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java index a343681b60..582335d170 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.broker; +import java.util.Set; import org.apache.activemq.Service; import org.apache.activemq.broker.region.Region; import org.apache.activemq.command.ActiveMQDestination; @@ -206,4 +207,9 @@ public interface Broker extends Region, Service { */ public boolean isStopped(); + /** + * @return a Set of all durable destinations + */ + public Set getDurableDestinations(); + } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java index fabc48961b..32faec8bd4 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.broker; +import java.util.Set; import org.apache.activemq.broker.region.Destination; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.BrokerId; @@ -187,5 +188,9 @@ public class BrokerFilter implements Broker { public boolean isStopped(){ return next.isStopped(); } + + public Set getDurableDestinations(){ + return next.getDurableDestinations(); + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java index 6c6d1d6c7f..41b6152ea1 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.broker; +import java.util.Set; import org.apache.activemq.broker.region.Destination; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.BrokerId; @@ -185,5 +186,9 @@ public class EmptyBroker implements Broker{ public boolean isStopped(){ return false; } + + public Set getDurableDestinations(){ + return null; + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java index 18097982bc..220c36df28 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.broker; +import java.util.Set; import org.apache.activemq.broker.region.Destination; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.BrokerId; @@ -184,5 +185,9 @@ public class ErrorBroker implements Broker { return true; } + public Set getDurableDestinations(){ + throw new IllegalStateException(this.message); + } + } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java b/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java index 5946ec24c8..2591ac2205 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.broker; +import java.util.Set; import org.apache.activemq.broker.region.Destination; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.BrokerId; @@ -197,5 +198,9 @@ public class MutableBrokerFilter implements Broker { public boolean isStopped(){ return getNext().isStopped(); } + + public Set getDurableDestinations(){ + return getNext().getDurableDestinations(); + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java index 50a572f25d..f5b9d8cf67 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java @@ -52,6 +52,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import java.util.Set; /** * Routes Broker operations to the correct messaging regions for processing. @@ -79,6 +80,7 @@ public class RegionBroker implements Broker { private BrokerId brokerId; private String brokerName; private Map clientIdSet = new HashMap(); // we will synchronize access + private PersistenceAdapter adaptor; public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory, UsageManager memoryManager, PersistenceAdapter adapter) throws IOException { this(brokerService,taskRunnerFactory, memoryManager, createDefaultPersistenceAdapter(memoryManager), null); @@ -87,7 +89,7 @@ public class RegionBroker implements Broker { public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory, UsageManager memoryManager, PersistenceAdapter adapter, PolicyMap policyMap) throws IOException { this.brokerService = brokerService; this.sequenceGenerator.setLastSequenceId( adapter.getLastMessageBrokerSequenceId() ); - + this.adaptor = adaptor; queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, adapter, policyMap); topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, adapter, policyMap); @@ -452,6 +454,10 @@ public class RegionBroker implements Broker { public boolean isStopped(){ return stopped; } + + public Set getDurableDestinations(){ + return adaptor.getDestinations(); + }