Class AbstractRegion
java.lang.Object
org.apache.activemq.broker.region.AbstractRegion
- All Implemented Interfaces:
Region,org.apache.activemq.Service
- Direct Known Subclasses:
AbstractTempRegion,QueueRegion,TopicRegion
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final RegionBrokerprotected final DestinationFactoryprotected final org.apache.activemq.filter.DestinationMapprotected final Map<org.apache.activemq.command.ActiveMQDestination,Destination> protected final ReentrantReadWriteLockprotected final DestinationStatisticsprotected final RegionStatisticsprotected booleanprotected final Map<org.apache.activemq.command.ConsumerId,Subscription> protected final org.apache.activemq.thread.TaskRunnerFactoryprotected final SystemUsage -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRegion(RegionBroker broker, DestinationStatistics destinationStatistics, SystemUsage memoryManager, org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.MessageAck ack) Used to acknowledge the receipt of a message by a client.addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) Adds a consumer.addDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createIfTemporary) Used to create a destination.voidaddProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) Adds a Producer.protected List<Subscription>addSubscriptionsForDestination(ConnectionContext context, Destination dest) protected DestinationcreateDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination) protected abstract SubscriptioncreateSubscription(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) protected voidprotected voiddispose(ConnectionContext context, Destination dest) voidgc()Map<org.apache.activemq.command.ActiveMQDestination,Destination> Returns a reference to the concurrent hash map that holds known destinations, do not modifygetDestinations(org.apache.activemq.command.ActiveMQDestination destination) Provide an exact or wildcard lookup of destinations in the regionGet all the Destinations that are in storageprotected Set<org.apache.activemq.command.ActiveMQDestination>Map<org.apache.activemq.command.ConsumerId,Subscription> booleanprotected Destinationlookup(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createTemporary) protected Destinationlookup(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createTemporary, boolean autoCreate) org.apache.activemq.command.ResponsemessagePull(ConnectionContext context, org.apache.activemq.command.MessagePull pull) Allows a consumer to pull a message from a queuevoidprocessConsumerControl(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.ConsumerControl control) voidprocessDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) Process a notification of a dispatch - used by a Slave Brokerprotected voidprocessDispatchNotificationViaDestination(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) voidvoidremoveConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) Removes a consumer.voidremoveDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, long timeout) Used to destroy a destination.voidremoveProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) Removes a Producer.voidremoveSubscription(ConnectionContext context, org.apache.activemq.command.RemoveSubscriptionInfo info) Deletes a durable subscription.voidsend(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend) Send a message to the broker to using the specified destination.voidsetAutoCreateDestinations(boolean autoCreateDestinations) final voidstart()voidstop()protected voidupdateRegionDestCounts(org.apache.activemq.command.ActiveMQDestination destination, int count) Updates the counts in RegionStatistics based on whether or not the destination is an Advisory Destination or notprotected voidvalidateMaxDestinations(org.apache.activemq.command.ActiveMQDestination destination) This method checks whether or not the destination can be created based onPolicyEntry.getMaxDestinations(), if it has been set.
-
Field Details
-
destinations
-
destinationMap
protected final org.apache.activemq.filter.DestinationMap destinationMap -
subscriptions
-
usageManager
-
destinationFactory
-
destinationStatistics
-
regionStatistics
-
broker
-
autoCreateDestinations
protected boolean autoCreateDestinations -
taskRunnerFactory
protected final org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory -
destinationsLock
-
consumerChangeMutexMap
-
started
protected boolean started
-
-
Constructor Details
-
AbstractRegion
public AbstractRegion(RegionBroker broker, DestinationStatistics destinationStatistics, SystemUsage memoryManager, org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory)
-
-
Method Details
-
start
- Specified by:
startin interfaceorg.apache.activemq.Service- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.apache.activemq.Service- Throws:
Exception
-
addDestination
public Destination addDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createIfTemporary) throws Exception Description copied from interface:RegionUsed to create a destination. Usually, this method is invoked as a side-effect of sending a message to a destination that does not exist yet.- Specified by:
addDestinationin interfaceRegiondestination- the destination to create.- Returns:
- TODO
- Throws:
Exception- TODO
-
getSubscriptions
-
updateRegionDestCounts
protected void updateRegionDestCounts(org.apache.activemq.command.ActiveMQDestination destination, int count) Updates the counts in RegionStatistics based on whether or not the destination is an Advisory Destination or not- Parameters:
destination- the destination being used to determine which counters to updatecount- the count to add to the counters
-
validateMaxDestinations
protected void validateMaxDestinations(org.apache.activemq.command.ActiveMQDestination destination) throws Exception This method checks whether or not the destination can be created based onPolicyEntry.getMaxDestinations(), if it has been set. Advisory topics are ignored.- Parameters:
destination-- Throws:
Exception
-
addSubscriptionsForDestination
protected List<Subscription> addSubscriptionsForDestination(ConnectionContext context, Destination dest) throws Exception - Throws:
Exception
-
removeDestination
public void removeDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, long timeout) throws Exception Description copied from interface:RegionUsed to destroy a destination. This should try to quiesce use of the destination up to the timeout allotted time before removing the destination. This will remove all persistent messages associated with the destination.- Specified by:
removeDestinationin interfaceRegion- Parameters:
context- the environment the operation is being executed under.destination- what is being removed from the broker.timeout- the max amount of time to wait for the destination to quiesce- Throws:
Exception- TODO
-
getDestinations
public Set<Destination> getDestinations(org.apache.activemq.command.ActiveMQDestination destination) Provide an exact or wildcard lookup of destinations in the region- Specified by:
getDestinationsin interfaceRegion- Returns:
- a set of matching destination objects.
-
getDestinationMap
Description copied from interface:RegionReturns a reference to the concurrent hash map that holds known destinations, do not modify- Specified by:
getDestinationMapin interfaceRegion
-
addConsumer
public Subscription addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception Description copied from interface:RegionAdds a consumer.- Specified by:
addConsumerin interfaceRegion- Parameters:
context- the environment the operation is being executed under.- Returns:
- TODO
- Throws:
Exception- TODO
-
getDurableDestinations
Get all the Destinations that are in storage- Returns:
- Set of all stored destinations
-
getInactiveDestinations
- Returns:
- all Destinations that don't have active consumers
-
removeConsumer
public void removeConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception Description copied from interface:RegionRemoves a consumer.- Specified by:
removeConsumerin interfaceRegion- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
destroySubscription
-
removeSubscription
public void removeSubscription(ConnectionContext context, org.apache.activemq.command.RemoveSubscriptionInfo info) throws Exception Description copied from interface:RegionDeletes a durable subscription.- Specified by:
removeSubscriptionin interfaceRegion- Parameters:
context- the environment the operation is being executed under.info- TODO- Throws:
Exception- TODO
-
send
public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend) throws Exception Description copied from interface:RegionSend a message to the broker to using the specified destination. The destination specified in the message does not need to match the destination the message is sent to. This is handy in case the message is being sent to a dead letter destination. -
acknowledge
public void acknowledge(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.MessageAck ack) throws Exception Description copied from interface:RegionUsed to acknowledge the receipt of a message by a client.- Specified by:
acknowledgein interfaceRegion- Parameters:
consumerExchange- the environment the operation is being executed under.- Throws:
Exception- TODO
-
messagePull
public org.apache.activemq.command.Response messagePull(ConnectionContext context, org.apache.activemq.command.MessagePull pull) throws Exception Description copied from interface:RegionAllows a consumer to pull a message from a queue- Specified by:
messagePullin interfaceRegion- Throws:
Exception
-
lookup
protected Destination lookup(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createTemporary) throws Exception - Throws:
Exception
-
lookup
protected Destination lookup(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createTemporary, boolean autoCreate) throws Exception - Throws:
Exception
-
processDispatchNotification
public void processDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception Description copied from interface:RegionProcess a notification of a dispatch - used by a Slave Broker- Specified by:
processDispatchNotificationin interfaceRegion- Throws:
Exception- TODO
-
processDispatchNotificationViaDestination
protected void processDispatchNotificationViaDestination(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception - Throws:
Exception
-
gc
public void gc() -
createSubscription
protected abstract Subscription createSubscription(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception - Throws:
Exception
-
createDestination
protected Destination createDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination) throws Exception - Throws:
Exception
-
isAutoCreateDestinations
public boolean isAutoCreateDestinations() -
setAutoCreateDestinations
public void setAutoCreateDestinations(boolean autoCreateDestinations) -
addProducer
public void addProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception Description copied from interface:RegionAdds a Producer.- Specified by:
addProducerin interfaceRegion- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
removeProducer
public void removeProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception Removes a Producer.- Specified by:
removeProducerin interfaceRegion- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
dispose
- Throws:
Exception
-
processConsumerControl
public void processConsumerControl(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.ConsumerControl control) - Specified by:
processConsumerControlin interfaceRegion
-
reapplyInterceptor
public void reapplyInterceptor()- Specified by:
reapplyInterceptorin interfaceRegion
-