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
This commit is contained in:
Robert Davies 2006-02-13 16:31:37 +00:00
parent f787e20139
commit debd0cc241
6 changed files with 33 additions and 1 deletions

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.broker; package org.apache.activemq.broker;
import java.util.Set;
import org.apache.activemq.Service; import org.apache.activemq.Service;
import org.apache.activemq.broker.region.Region; import org.apache.activemq.broker.region.Region;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
@ -206,4 +207,9 @@ public interface Broker extends Region, Service {
*/ */
public boolean isStopped(); public boolean isStopped();
/**
* @return a Set of all durable destinations
*/
public Set getDurableDestinations();
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.broker; package org.apache.activemq.broker;
import java.util.Set;
import org.apache.activemq.broker.region.Destination; import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.BrokerId; import org.apache.activemq.command.BrokerId;
@ -187,5 +188,9 @@ public class BrokerFilter implements Broker {
public boolean isStopped(){ public boolean isStopped(){
return next.isStopped(); return next.isStopped();
} }
public Set getDurableDestinations(){
return next.getDurableDestinations();
}
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.broker; package org.apache.activemq.broker;
import java.util.Set;
import org.apache.activemq.broker.region.Destination; import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.BrokerId; import org.apache.activemq.command.BrokerId;
@ -185,5 +186,9 @@ public class EmptyBroker implements Broker{
public boolean isStopped(){ public boolean isStopped(){
return false; return false;
} }
public Set getDurableDestinations(){
return null;
}
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.broker; package org.apache.activemq.broker;
import java.util.Set;
import org.apache.activemq.broker.region.Destination; import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.BrokerId; import org.apache.activemq.command.BrokerId;
@ -184,5 +185,9 @@ public class ErrorBroker implements Broker {
return true; return true;
} }
public Set getDurableDestinations(){
throw new IllegalStateException(this.message);
}
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.broker; package org.apache.activemq.broker;
import java.util.Set;
import org.apache.activemq.broker.region.Destination; import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.BrokerId; import org.apache.activemq.command.BrokerId;
@ -197,5 +198,9 @@ public class MutableBrokerFilter implements Broker {
public boolean isStopped(){ public boolean isStopped(){
return getNext().isStopped(); return getNext().isStopped();
} }
public Set getDurableDestinations(){
return getNext().getDurableDestinations();
}
} }

View File

@ -52,6 +52,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Routes Broker operations to the correct messaging regions for processing. * Routes Broker operations to the correct messaging regions for processing.
@ -79,6 +80,7 @@ public class RegionBroker implements Broker {
private BrokerId brokerId; private BrokerId brokerId;
private String brokerName; private String brokerName;
private Map clientIdSet = new HashMap(); // we will synchronize access private Map clientIdSet = new HashMap(); // we will synchronize access
private PersistenceAdapter adaptor;
public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory, UsageManager memoryManager, PersistenceAdapter adapter) throws IOException { public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory, UsageManager memoryManager, PersistenceAdapter adapter) throws IOException {
this(brokerService,taskRunnerFactory, memoryManager, createDefaultPersistenceAdapter(memoryManager), null); 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 { public RegionBroker(BrokerService brokerService,TaskRunnerFactory taskRunnerFactory, UsageManager memoryManager, PersistenceAdapter adapter, PolicyMap policyMap) throws IOException {
this.brokerService = brokerService; this.brokerService = brokerService;
this.sequenceGenerator.setLastSequenceId( adapter.getLastMessageBrokerSequenceId() ); this.sequenceGenerator.setLastSequenceId( adapter.getLastMessageBrokerSequenceId() );
this.adaptor = adaptor;
queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, adapter, policyMap); queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, adapter, policyMap);
topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, adapter, policyMap); topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, adapter, policyMap);
@ -452,6 +454,10 @@ public class RegionBroker implements Broker {
public boolean isStopped(){ public boolean isStopped(){
return stopped; return stopped;
} }
public Set getDurableDestinations(){
return adaptor.getDestinations();
}