protected Destination createDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception { return destinationFactory.createDestination(context, destination, destinationStatistics); }
protected void buildExistingSubscriptions() throws Exception { Map<SubscriptionKey, SubscriptionInfo> subscriptions = new HashMap<SubscriptionKey, SubscriptionInfo>(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); if (destinations != null) { for (ActiveMQDestination dest : destinations) { if (dest.isTopic()) { SubscriptionInfo[] infos = destinationFactory.getAllDurableSubscriptions((ActiveMQTopic)dest); if (infos != null) { for (int i = 0; i < infos.length; i++) { SubscriptionInfo info = infos[i]; SubscriptionKey key = new SubscriptionKey(info); if (!alreadyKnown(key)) { LOG.debug("Restoring durable subscription MBean {}", info); subscriptions.put(key, info); } } } } } } for (Map.Entry<SubscriptionKey, SubscriptionInfo> entry : subscriptions.entrySet()) { addInactiveSubscription(entry.getKey(), entry.getValue(), null); } }
public RegionBroker(BrokerService brokerService, TaskRunnerFactory taskRunnerFactory, SystemUsage memoryManager, DestinationFactory destinationFactory, DestinationInterceptor destinationInterceptor, Scheduler scheduler, ThreadPoolExecutor executor) throws IOException { this.brokerService = brokerService; this.executor = executor; this.scheduler = scheduler; if (destinationFactory == null) { throw new IllegalArgumentException("null destinationFactory"); } this.sequenceGenerator.setLastSequenceId(destinationFactory.getLastMessageBrokerSequenceId()); this.destinationFactory = destinationFactory; queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, destinationFactory); topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, destinationFactory); this.destinationInterceptor = destinationInterceptor; tempQueueRegion = createTempQueueRegion(memoryManager, taskRunnerFactory, destinationFactory); tempTopicRegion = createTempTopicRegion(memoryManager, taskRunnerFactory, destinationFactory); this.taskRunnerFactory = taskRunnerFactory; }
/** * Get all the Destinations that are in storage * * @return Set of all stored destinations */ @SuppressWarnings("rawtypes") public Set getDurableDestinations() { return destinationFactory.getDestinations(); }
protected void dispose(ConnectionContext context, Destination dest) throws Exception { dest.dispose(context); dest.stop(); destinationFactory.removeDestination(dest); }
protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException { RegionBroker regionBroker; if (isUseJmx()) { try { regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(), getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } catch(MalformedObjectNameException me){ LOG.warn("Cannot create ManagedRegionBroker due " + me.getMessage(), me); throw new IOException(me); } } else { regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } destinationFactory.setRegionBroker(regionBroker); regionBroker.setKeepDurableSubsActive(keepDurableSubsActive); regionBroker.setBrokerName(getBrokerName()); regionBroker.getDestinationStatistics().setEnabled(enableStatistics); regionBroker.setAllowTempAutoCreationOnSend(isAllowTempAutoCreationOnSend()); if (brokerId != null) { regionBroker.setBrokerId(brokerId); } return regionBroker; }
@Override public Set<ActiveMQDestination> getDurableDestinations() { return destinationFactory.getDestinations(); }
protected void dispose(ConnectionContext context, Destination dest) throws Exception { dest.dispose(context); dest.stop(); destinationFactory.removeDestination(dest); }
protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException { RegionBroker regionBroker; if (isUseJmx()) { try { regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(), getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } catch(MalformedObjectNameException me){ LOG.warn("Cannot create ManagedRegionBroker due " + me.getMessage(), me); throw new IOException(me); } } else { regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } destinationFactory.setRegionBroker(regionBroker); regionBroker.setKeepDurableSubsActive(keepDurableSubsActive); regionBroker.setBrokerName(getBrokerName()); regionBroker.getDestinationStatistics().setEnabled(enableStatistics); regionBroker.setAllowTempAutoCreationOnSend(isAllowTempAutoCreationOnSend()); if (brokerId != null) { regionBroker.setBrokerId(brokerId); } return regionBroker; }
/** * @return all Destinations that don't have active consumers */ protected Set<ActiveMQDestination> getInactiveDestinations() { Set<ActiveMQDestination> inactiveDests = destinationFactory.getDestinations(); destinationsLock.readLock().lock(); try { inactiveDests.removeAll(destinations.keySet()); } finally { destinationsLock.readLock().unlock(); } return inactiveDests; }
protected void buildExistingSubscriptions() throws Exception { Map<SubscriptionKey, SubscriptionInfo> subscriptions = new HashMap<SubscriptionKey, SubscriptionInfo>(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); if (destinations != null) { for (ActiveMQDestination dest : destinations) { if (dest.isTopic()) { SubscriptionInfo[] infos = destinationFactory.getAllDurableSubscriptions((ActiveMQTopic)dest); if (infos != null) { for (int i = 0; i < infos.length; i++) { SubscriptionInfo info = infos[i]; SubscriptionKey key = new SubscriptionKey(info); if (!alreadyKnown(key)) { LOG.debug("Restoring durable subscription MBean {}", info); subscriptions.put(key, info); } } } } } } for (Map.Entry<SubscriptionKey, SubscriptionInfo> entry : subscriptions.entrySet()) { addInactiveSubscription(entry.getKey(), entry.getValue(), null); } }
protected synchronized Destination createDestination( ConnectionContext context, ActiveMQDestination destination) throws Exception { Destination result = cachedDestinations.remove(new CachedDestination( destination)); if (result == null) { result = destinationFactory.createDestination(context, destination, destinationStatistics); } return result; }
protected void dispose(ConnectionContext context, Destination dest) throws Exception { dest.dispose(context); dest.stop(); destinationFactory.removeDestination(dest); }
public RegionBroker(BrokerService brokerService, TaskRunnerFactory taskRunnerFactory, SystemUsage memoryManager, DestinationFactory destinationFactory, DestinationInterceptor destinationInterceptor, Scheduler scheduler, ThreadPoolExecutor executor) throws IOException { this.brokerService = brokerService; this.executor = executor; this.scheduler = scheduler; if (destinationFactory == null) { throw new IllegalArgumentException("null destinationFactory"); } this.sequenceGenerator.setLastSequenceId(destinationFactory.getLastMessageBrokerSequenceId()); this.destinationFactory = destinationFactory; queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, destinationFactory); topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, destinationFactory); this.destinationInterceptor = destinationInterceptor; tempQueueRegion = createTempQueueRegion(memoryManager, taskRunnerFactory, destinationFactory); tempTopicRegion = createTempTopicRegion(memoryManager, taskRunnerFactory, destinationFactory); }
protected Broker createRegionBroker(DestinationInterceptor destinationInterceptor) throws IOException { RegionBroker regionBroker; if (isUseJmx()) { try { regionBroker = new ManagedRegionBroker(this, getManagementContext(), getBrokerObjectName(), getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } catch(MalformedObjectNameException me){ LOG.warn("Cannot create ManagedRegionBroker due " + me.getMessage(), me); throw new IOException(me); } } else { regionBroker = new RegionBroker(this, getTaskRunnerFactory(), getConsumerSystemUsage(), destinationFactory, destinationInterceptor,getScheduler(),getExecutor()); } destinationFactory.setRegionBroker(regionBroker); regionBroker.setKeepDurableSubsActive(keepDurableSubsActive); regionBroker.setBrokerName(getBrokerName()); regionBroker.getDestinationStatistics().setEnabled(enableStatistics); regionBroker.setAllowTempAutoCreationOnSend(isAllowTempAutoCreationOnSend()); if (brokerId != null) { regionBroker.setBrokerId(brokerId); } return regionBroker; }
protected void startVirtualConsumerDestinations() throws Exception { checkStartException(); ConnectionContext adminConnectionContext = getAdminConnectionContext(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); DestinationFilter filter = getVirtualTopicConsumerDestinationFilter(); if (!destinations.isEmpty()) { for (ActiveMQDestination destination : destinations) { if (filter.matches(destination) == true) { broker.addDestination(adminConnectionContext, destination, false); } } } }
protected void buildExistingSubscriptions() throws Exception { Map<SubscriptionKey, SubscriptionInfo> subscriptions = new HashMap<SubscriptionKey, SubscriptionInfo>(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); if (destinations != null) { for (ActiveMQDestination dest : destinations) { if (dest.isTopic()) { SubscriptionInfo[] infos = destinationFactory.getAllDurableSubscriptions((ActiveMQTopic)dest); if (infos != null) { for (int i = 0; i < infos.length; i++) { SubscriptionInfo info = infos[i]; SubscriptionKey key = new SubscriptionKey(info); if (!alreadyKnown(key)) { LOG.debug("Restoring durable subscription MBean {}", info); subscriptions.put(key, info); } } } } } } for (Map.Entry<SubscriptionKey, SubscriptionInfo> entry : subscriptions.entrySet()) { addInactiveSubscription(entry.getKey(), entry.getValue(), null); } }
protected Destination createDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception { return destinationFactory.createDestination(context, destination, destinationStatistics); }
protected void dispose(ConnectionContext context, Destination dest) throws Exception { dest.dispose(context); dest.stop(); destinationFactory.removeDestination(dest); }
public RegionBroker(BrokerService brokerService, TaskRunnerFactory taskRunnerFactory, SystemUsage memoryManager, DestinationFactory destinationFactory, DestinationInterceptor destinationInterceptor,Scheduler scheduler,ThreadPoolExecutor executor) throws IOException { this.brokerService = brokerService; this.executor=executor; this.scheduler = scheduler; if (destinationFactory == null) { throw new IllegalArgumentException("null destinationFactory"); } this.sequenceGenerator.setLastSequenceId(destinationFactory.getLastMessageBrokerSequenceId()); this.destinationFactory = destinationFactory; queueRegion = createQueueRegion(memoryManager, taskRunnerFactory, destinationFactory); topicRegion = createTopicRegion(memoryManager, taskRunnerFactory, destinationFactory); this.destinationInterceptor = destinationInterceptor; tempQueueRegion = createTempQueueRegion(memoryManager, taskRunnerFactory, destinationFactory); tempTopicRegion = createTempTopicRegion(memoryManager, taskRunnerFactory, destinationFactory); }