org.apache.qpid.server.subscription
Class SubscriptionImpl

java.lang.Object
  extended by org.apache.qpid.server.subscription.SubscriptionImpl
All Implemented Interfaces:
ConfiguredObject<SubscriptionConfigType,SubscriptionConfig>, SubscriptionConfig, FlowCreditManager.FlowCreditManagerListener, Subscription
Direct Known Subclasses:
SubscriptionImpl.AckSubscription, SubscriptionImpl.BrowserSubscription, SubscriptionImpl.NoAckSubscription

public abstract class SubscriptionImpl
extends Object
implements Subscription, FlowCreditManager.FlowCreditManagerListener, SubscriptionConfig

Encapsulation of a supscription to a queue.

Ties together the protocol session of a subscriber, the consumer tag that was given out by the broker and the channel id.


Nested Class Summary
(package private) static class SubscriptionImpl.AckSubscription
           
(package private) static class SubscriptionImpl.BrowserSubscription
           
static class SubscriptionImpl.NoAckSubscription
           
 
Nested classes/interfaces inherited from interface org.apache.qpid.server.subscription.Subscription
Subscription.State, Subscription.StateListener
 
Constructor Summary
SubscriptionImpl(AMQChannel channel, AMQProtocolSession protocolSession, org.apache.qpid.framing.AMQShortString consumerTag, org.apache.qpid.framing.FieldTable arguments, boolean noLocal, FlowCreditManager creditManager, ClientDeliveryMethod deliveryMethod, RecordDeliveryMethod recordMethod)
           
 
Method Summary
 boolean acquires()
           
 void close()
           
 void confirmAutoClose()
           
 void creditStateChanged(boolean hasCredit)
           
 boolean filtersMessages()
           
 Object get(String key)
           
 Map<String,Object> getArguments()
           
 QueueEntry.SubscriptionAssignedState getAssignedState()
           
 AMQChannel getChannel()
           
 ConfigStore getConfigStore()
           
 SubscriptionConfigType getConfigType()
           
 org.apache.qpid.framing.AMQShortString getConsumerTag()
           
 long getCreateTime()
           
 FlowCreditManager getCreditManager()
           
 String getCreditMode()
           
 Long getDelivered()
           
 UUID getId()
           
 LogActor getLogActor()
           
 String getName()
           
 QueueEntry.SubscriptionAcquiredState getOwningState()
           
 ConfiguredObject getParent()
           
 AMQProtocolSession getProtocolSession()
           
 AMQQueue getQueue()
           
 AMQQueue.Context getQueueContext()
           
 void getSendLock()
           
 SessionConfig getSessionConfig()
           
 Subscription.State getState()
           
 long getSubscriptionID()
           
 boolean hasInterest(QueueEntry entry)
           
 boolean isActive()
           
 boolean isAutoClose()
           
(package private) abstract  boolean isBrowser()
           
 boolean isBrowsing()
           
 boolean isClosed()
           
 boolean isDurable()
           
 boolean isExclusive()
           
 boolean isExplicitAcknowledge()
           
 boolean isSessionTransactional()
           
 boolean isSuspended()
           
 boolean isTransient()
           
 void onDequeue(QueueEntry queueEntry)
           
 void queueDeleted(AMQQueue queue)
          Callback indicating that a queue has been deleted.
protected  void recordMessageDelivery(QueueEntry entry, long deliveryTag)
           
 void releaseSendLock()
           
 void restoreCredit(QueueEntry queueEntry)
           
 boolean seesRequeues()
           
abstract  void send(QueueEntry msg)
          This method can be called by each of the publisher threads.
protected  void sendToClient(QueueEntry entry, long deliveryTag)
           
 void set(String key, Object value)
           
 void setNoLocal(boolean noLocal)
           
 void setQueue(AMQQueue queue, boolean exclusive)
           
 void setQueueContext(AMQQueue.Context context)
           
 void setStateListener(Subscription.StateListener listener)
           
 String toString()
           
 boolean wouldSuspend(QueueEntry msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubscriptionImpl

public SubscriptionImpl(AMQChannel channel,
                        AMQProtocolSession protocolSession,
                        org.apache.qpid.framing.AMQShortString consumerTag,
                        org.apache.qpid.framing.FieldTable arguments,
                        boolean noLocal,
                        FlowCreditManager creditManager,
                        ClientDeliveryMethod deliveryMethod,
                        RecordDeliveryMethod recordMethod)
                 throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException
Method Detail

getConfigStore

public ConfigStore getConfigStore()

getDelivered

public Long getDelivered()
Specified by:
getDelivered in interface SubscriptionConfig

setQueue

public void setQueue(AMQQueue queue,
                     boolean exclusive)
Specified by:
setQueue in interface Subscription

toString

public String toString()
Overrides:
toString in class Object

send

public abstract void send(QueueEntry msg)
                   throws org.apache.qpid.AMQException
This method can be called by each of the publisher threads. As a result all changes to the channel object must be thread safe.

Specified by:
send in interface Subscription
Parameters:
msg - The message to send
Throws:
org.apache.qpid.AMQException

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface Subscription

queueDeleted

public void queueDeleted(AMQQueue queue)
Callback indicating that a queue has been deleted.

Specified by:
queueDeleted in interface Subscription
Parameters:
queue - The queue to delete

filtersMessages

public boolean filtersMessages()

hasInterest

public boolean hasInterest(QueueEntry entry)
Specified by:
hasInterest in interface Subscription

isAutoClose

public boolean isAutoClose()
Specified by:
isAutoClose in interface Subscription

getCreditManager

public FlowCreditManager getCreditManager()

close

public void close()
Specified by:
close in interface Subscription

isClosed

public boolean isClosed()
Specified by:
isClosed in interface Subscription

wouldSuspend

public boolean wouldSuspend(QueueEntry msg)
Specified by:
wouldSuspend in interface Subscription

getSendLock

public void getSendLock()
Specified by:
getSendLock in interface Subscription

releaseSendLock

public void releaseSendLock()
Specified by:
releaseSendLock in interface Subscription

getChannel

public AMQChannel getChannel()

getConsumerTag

public org.apache.qpid.framing.AMQShortString getConsumerTag()
Specified by:
getConsumerTag in interface Subscription

getSubscriptionID

public long getSubscriptionID()
Specified by:
getSubscriptionID in interface Subscription

getProtocolSession

public AMQProtocolSession getProtocolSession()

getLogActor

public LogActor getLogActor()
Specified by:
getLogActor in interface Subscription

getQueue

public AMQQueue getQueue()
Specified by:
getQueue in interface SubscriptionConfig
Specified by:
getQueue in interface Subscription

onDequeue

public void onDequeue(QueueEntry queueEntry)
Specified by:
onDequeue in interface Subscription

restoreCredit

public void restoreCredit(QueueEntry queueEntry)
Specified by:
restoreCredit in interface Subscription

creditStateChanged

public void creditStateChanged(boolean hasCredit)
Specified by:
creditStateChanged in interface FlowCreditManager.FlowCreditManagerListener

getState

public Subscription.State getState()
Specified by:
getState in interface Subscription

setStateListener

public void setStateListener(Subscription.StateListener listener)
Specified by:
setStateListener in interface Subscription

getQueueContext

public AMQQueue.Context getQueueContext()
Specified by:
getQueueContext in interface Subscription

setQueueContext

public void setQueueContext(AMQQueue.Context context)
Specified by:
setQueueContext in interface Subscription

sendToClient

protected void sendToClient(QueueEntry entry,
                            long deliveryTag)
                     throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

recordMessageDelivery

protected void recordMessageDelivery(QueueEntry entry,
                                     long deliveryTag)

isActive

public boolean isActive()
Specified by:
isActive in interface Subscription

getOwningState

public QueueEntry.SubscriptionAcquiredState getOwningState()
Specified by:
getOwningState in interface Subscription

getAssignedState

public QueueEntry.SubscriptionAssignedState getAssignedState()
Specified by:
getAssignedState in interface Subscription

confirmAutoClose

public void confirmAutoClose()
Specified by:
confirmAutoClose in interface Subscription

acquires

public boolean acquires()
Specified by:
acquires in interface Subscription

seesRequeues

public boolean seesRequeues()
Specified by:
seesRequeues in interface Subscription

isTransient

public boolean isTransient()
Specified by:
isTransient in interface Subscription

set

public void set(String key,
                Object value)
Specified by:
set in interface Subscription

get

public Object get(String key)
Specified by:
get in interface Subscription

setNoLocal

public void setNoLocal(boolean noLocal)
Specified by:
setNoLocal in interface Subscription

isBrowser

abstract boolean isBrowser()

getCreditMode

public String getCreditMode()
Specified by:
getCreditMode in interface SubscriptionConfig

getSessionConfig

public SessionConfig getSessionConfig()
Specified by:
getSessionConfig in interface SubscriptionConfig

isBrowsing

public boolean isBrowsing()
Specified by:
isBrowsing in interface SubscriptionConfig

isExplicitAcknowledge

public boolean isExplicitAcknowledge()
Specified by:
isExplicitAcknowledge in interface SubscriptionConfig

getId

public UUID getId()
Specified by:
getId in interface ConfiguredObject<SubscriptionConfigType,SubscriptionConfig>

isDurable

public boolean isDurable()
Specified by:
isDurable in interface ConfiguredObject<SubscriptionConfigType,SubscriptionConfig>

getConfigType

public SubscriptionConfigType getConfigType()
Specified by:
getConfigType in interface ConfiguredObject<SubscriptionConfigType,SubscriptionConfig>

isExclusive

public boolean isExclusive()
Specified by:
isExclusive in interface SubscriptionConfig

getParent

public ConfiguredObject getParent()
Specified by:
getParent in interface ConfiguredObject<SubscriptionConfigType,SubscriptionConfig>

getName

public String getName()
Specified by:
getName in interface SubscriptionConfig

getArguments

public Map<String,Object> getArguments()
Specified by:
getArguments in interface SubscriptionConfig

isSessionTransactional

public boolean isSessionTransactional()
Specified by:
isSessionTransactional in interface Subscription

getCreateTime

public long getCreateTime()
Specified by:
getCreateTime in interface ConfiguredObject<SubscriptionConfigType,SubscriptionConfig>


Licensed to the Apache Software Foundation