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

public abstract class AbstractRegion extends Object implements Region
  • Field Details

    • destinations

      protected final Map<org.apache.activemq.command.ActiveMQDestination,Destination> destinations
    • destinationMap

      protected final org.apache.activemq.filter.DestinationMap destinationMap
    • subscriptions

      protected final Map<org.apache.activemq.command.ConsumerId,Subscription> subscriptions
    • usageManager

      protected final SystemUsage usageManager
    • destinationFactory

      protected final DestinationFactory destinationFactory
    • destinationStatistics

      protected final DestinationStatistics destinationStatistics
    • regionStatistics

      protected final RegionStatistics regionStatistics
    • broker

      protected final RegionBroker broker
    • autoCreateDestinations

      protected boolean autoCreateDestinations
    • taskRunnerFactory

      protected final org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory
    • destinationsLock

      protected final ReentrantReadWriteLock destinationsLock
    • consumerChangeMutexMap

      protected final Map<org.apache.activemq.command.ConsumerId,Object> consumerChangeMutexMap
    • started

      protected boolean started
  • Constructor Details

  • Method Details

    • start

      public final void start() throws Exception
      Specified by:
      start in interface org.apache.activemq.Service
      Throws:
      Exception
    • stop

      public void stop() throws Exception
      Specified by:
      stop in interface org.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: Region
      Used 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:
      addDestination in interface Region
      destination - the destination to create.
      Returns:
      TODO
      Throws:
      Exception - TODO
    • getSubscriptions

      public Map<org.apache.activemq.command.ConsumerId,Subscription> 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 update
      count - 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 on PolicyEntry.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: Region
      Used 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:
      removeDestination in interface Region
      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:
      getDestinations in interface Region
      Returns:
      a set of matching destination objects.
    • getDestinationMap

      public Map<org.apache.activemq.command.ActiveMQDestination,Destination> getDestinationMap()
      Description copied from interface: Region
      Returns a reference to the concurrent hash map that holds known destinations, do not modify
      Specified by:
      getDestinationMap in interface Region
    • addConsumer

      public Subscription addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception
      Description copied from interface: Region
      Adds a consumer.
      Specified by:
      addConsumer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Returns:
      TODO
      Throws:
      Exception - TODO
    • getDurableDestinations

      public Set getDurableDestinations()
      Get all the Destinations that are in storage
      Returns:
      Set of all stored destinations
    • getInactiveDestinations

      protected Set<org.apache.activemq.command.ActiveMQDestination> 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: Region
      Removes a consumer.
      Specified by:
      removeConsumer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • destroySubscription

      protected void destroySubscription(Subscription sub)
    • removeSubscription

      public void removeSubscription(ConnectionContext context, org.apache.activemq.command.RemoveSubscriptionInfo info) throws Exception
      Description copied from interface: Region
      Deletes a durable subscription.
      Specified by:
      removeSubscription in interface Region
      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: Region
      Send 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.
      Specified by:
      send in interface Region
      Parameters:
      producerExchange - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • acknowledge

      public void acknowledge(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.MessageAck ack) throws Exception
      Description copied from interface: Region
      Used to acknowledge the receipt of a message by a client.
      Specified by:
      acknowledge in interface Region
      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: Region
      Allows a consumer to pull a message from a queue
      Specified by:
      messagePull in interface Region
      Throws:
      Exception
    • lookup

      protected Destination lookup(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean createTemporary) throws Exception
      Throws:
      Exception
    • processDispatchNotification

      public void processDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception
      Description copied from interface: Region
      Process a notification of a dispatch - used by a Slave Broker
      Specified by:
      processDispatchNotification in interface Region
      Throws:
      Exception - TODO
    • processDispatchNotificationViaDestination

      protected void processDispatchNotificationViaDestination(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception
      Throws:
      Exception
    • gc

      public void gc()
      Specified by:
      gc in interface Region
    • 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: Region
      Adds a Producer.
      Specified by:
      addProducer in interface Region
      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:
      removeProducer in interface Region
      Parameters:
      context - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • dispose

      protected void dispose(ConnectionContext context, Destination dest) throws Exception
      Throws:
      Exception
    • processConsumerControl

      public void processConsumerControl(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.ConsumerControl control)
      Specified by:
      processConsumerControl in interface Region
    • reapplyInterceptor

      public void reapplyInterceptor()
      Specified by:
      reapplyInterceptor in interface Region