1 18 package org.apache.activemq.broker.region; 19 20 import org.apache.activemq.broker.ConnectionContext; 21 import org.apache.activemq.command.ActiveMQDestination; 22 import org.apache.activemq.command.ConsumerInfo; 23 import org.apache.activemq.memory.UsageManager; 24 import org.apache.activemq.thread.TaskRunnerFactory; 25 26 import javax.jms.InvalidSelectorException ; 27 28 import java.util.Iterator ; 29 import java.util.Set ; 30 31 35 public class QueueRegion extends AbstractRegion { 36 37 38 39 public QueueRegion(RegionBroker broker,DestinationStatistics destinationStatistics, UsageManager memoryManager, TaskRunnerFactory taskRunnerFactory, 40 DestinationFactory destinationFactory) { 41 super(broker,destinationStatistics, memoryManager, taskRunnerFactory, destinationFactory); 42 } 43 44 public String toString() { 45 return "QueueRegion: destinations=" + destinations.size() + ", subscriptions=" + subscriptions.size() + ", memory=" + memoryManager.getPercentUsage() 46 + "%"; 47 } 48 49 protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws InvalidSelectorException { 50 if (info.isBrowser()) { 51 return new QueueBrowserSubscription(broker,context, info); 52 } 53 else { 54 return new QueueSubscription(broker,context, info); 55 } 56 } 57 58 protected Set getInactiveDestinations() { 59 Set inactiveDestinations = super.getInactiveDestinations(); 60 for (Iterator iter = inactiveDestinations.iterator(); iter.hasNext();) { 61 ActiveMQDestination dest = (ActiveMQDestination) iter.next(); 62 if (!dest.isQueue()) 63 iter.remove(); 64 } 65 return inactiveDestinations; 66 } 67 } 68 | Popular Tags |