org.apache.activemq.broker.region
Class AbstractSubscription

java.lang.Object
  extended by org.apache.activemq.broker.region.AbstractSubscription
All Implemented Interfaces:
Subscription
Direct Known Subclasses:
PrefetchSubscription, TopicSubscription

public abstract class AbstractSubscription
extends java.lang.Object
implements Subscription


Field Summary
protected  Broker broker
           
protected  ConnectionContext context
           
protected  DestinationFilter destinationFilter
           
protected  edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList destinations
           
protected  ConsumerInfo info
           
 
Constructor Summary
AbstractSubscription(Broker broker, ConnectionContext context, ConsumerInfo info)
           
 
Method Summary
 void add(ConnectionContext context, Destination destination)
          The subscription will be receiving messages from the destination.
 void gc()
          The subscription should release as may references as it can to help the garbage collector reclaim memory.
 ConsumerInfo getConsumerInfo()
          The ConsumerInfo object that created the subscription.
 ConnectionContext getContext()
           
 ConsumerInfo getInfo()
           
 javax.management.ObjectName getObjectName()
           
 int getPrefetchSize()
           
 java.lang.String getSelector()
           
 BooleanExpression getSelectorExpression()
           
 boolean isRecoveryRequired()
          Informs the Broker if the subscription needs to intervention to recover it's state e.g.
 boolean isSlaveBroker()
           
 boolean matches(ActiveMQDestination destination)
          Is the subscription interested in messages in the destination?
 boolean matches(MessageReference node, MessageEvaluationContext context)
          Is the subscription interested in the message?
 void remove(ConnectionContext context, Destination destination)
          The subscription will be no longer be receiving messages from the destination.
 void setObjectName(javax.management.ObjectName objectName)
          Set when the subscription is registered in JMX
 void setSelector(java.lang.String selector)
          Attempts to change the current active selector on the subscription.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.broker.region.Subscription
acknowledge, add, destroy, getDequeueCounter, getDispatchedCounter, getDispatchedQueueSize, getEnqueueCounter, getPendingQueueSize, isHighWaterMark, isLowWaterMark, optimizePrefetch, processMessageDispatchNotification, pullMessage, updateConsumerPrefetch
 

Field Detail

broker

protected Broker broker

context

protected ConnectionContext context

info

protected ConsumerInfo info

destinationFilter

protected final DestinationFilter destinationFilter

destinations

protected final edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList destinations
Constructor Detail

AbstractSubscription

public AbstractSubscription(Broker broker,
                            ConnectionContext context,
                            ConsumerInfo info)
                     throws javax.jms.InvalidSelectorException
Throws:
javax.jms.InvalidSelectorException
Method Detail

matches

public boolean matches(MessageReference node,
                       MessageEvaluationContext context)
                throws java.io.IOException
Description copied from interface: Subscription
Is the subscription interested in the message?

Specified by:
matches in interface Subscription
Returns:
Throws:
java.io.IOException

matches

public boolean matches(ActiveMQDestination destination)
Description copied from interface: Subscription
Is the subscription interested in messages in the destination?

Specified by:
matches in interface Subscription
Returns:

add

public void add(ConnectionContext context,
                Destination destination)
         throws java.lang.Exception
Description copied from interface: Subscription
The subscription will be receiving messages from the destination.

Specified by:
add in interface Subscription
Throws:
java.lang.Exception

remove

public void remove(ConnectionContext context,
                   Destination destination)
            throws java.lang.Exception
Description copied from interface: Subscription
The subscription will be no longer be receiving messages from the destination.

Specified by:
remove in interface Subscription
Throws:
java.lang.Exception

getConsumerInfo

public ConsumerInfo getConsumerInfo()
Description copied from interface: Subscription
The ConsumerInfo object that created the subscription.

Specified by:
getConsumerInfo in interface Subscription

gc

public void gc()
Description copied from interface: Subscription
The subscription should release as may references as it can to help the garbage collector reclaim memory.

Specified by:
gc in interface Subscription

isSlaveBroker

public boolean isSlaveBroker()
Specified by:
isSlaveBroker in interface Subscription
Returns:
true if the broker is currently in slave mode

getContext

public ConnectionContext getContext()

getInfo

public ConsumerInfo getInfo()

getSelectorExpression

public BooleanExpression getSelectorExpression()

getSelector

public java.lang.String getSelector()
Specified by:
getSelector in interface Subscription
Returns:
the JMS selector on the current subscription

setSelector

public void setSelector(java.lang.String selector)
                 throws javax.jms.InvalidSelectorException
Description copied from interface: Subscription
Attempts to change the current active selector on the subscription. This operation is not supported for persistent topics.

Specified by:
setSelector in interface Subscription
Throws:
javax.jms.InvalidSelectorException

getObjectName

public javax.management.ObjectName getObjectName()
Specified by:
getObjectName in interface Subscription
Returns:
the JMX object name that this subscription was registered as if applicable

setObjectName

public void setObjectName(javax.management.ObjectName objectName)
Description copied from interface: Subscription
Set when the subscription is registered in JMX

Specified by:
setObjectName in interface Subscription

getPrefetchSize

public int getPrefetchSize()
Specified by:
getPrefetchSize in interface Subscription
Returns:
the prefetch size that is configured for the subscription

isRecoveryRequired

public boolean isRecoveryRequired()
Description copied from interface: Subscription
Informs the Broker if the subscription needs to intervention to recover it's state e.g. DurableTopicSubscriber may do

Specified by:
isRecoveryRequired in interface Subscription
Returns:
true if recovery required
See Also:
org.apache.activemq.region.cursors.PendingMessageCursor


Copyright © 2009 Apache Software Foundation. All Rights Reserved.