Class StoreDurableSubscriberCursor
- java.lang.Object
-
- org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
-
- org.apache.activemq.broker.region.cursors.StoreDurableSubscriberCursor
-
- All Implemented Interfaces:
PendingMessageCursor,Service
public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor
persist pending messages pending message (messages awaiting dispatch to a consumer) cursor
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
audit, cacheEnabled, enableAudit, last, maxAuditDepth, maxBatchSize, maxProducersToAudit, memoryUsageHighWaterMark, prioritizedMessages, started, systemUsage, useCache
-
Fields inherited from interface org.apache.activemq.broker.region.cursors.PendingMessageCursor
INFINITE_WAIT
-
-
Constructor Summary
Constructors Constructor Description StoreDurableSubscriberCursor(Broker broker, String clientId, String subscriberName, int maxBatchSize, DurableTopicSubscription subscription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ConnectionContext context, Destination destination)Add a destinationvoidaddMessageFirst(MessageReference node)add message to await dispatchvoidaddRecoveredMessage(MessageReference node)Add a message recovered from a retroactive policyvoidclear()clear all pending messagesvoidgc()free up any internal buffersprotected PendingMessageCursorgetNextCursor()booleanhasNext()booleanisEmpty()booleanisEmpty(Destination destination)check if a Destination is Empty for this cursorbooleanisImmediatePriorityDispatch()booleanisRecoveryRequired()Informs the Broker if the subscription needs to intervention to recover it's state e.g.booleanisTransient()longmessageSize()MessageReferencenext()voidrelease()hint to the cursor to release any locks it might have grabbed after a resetvoidremove()remove the message at the cursor positionList<MessageReference>remove(ConnectionContext context, Destination destination)remove a destinationvoidremove(MessageReference node)remove a nodevoidreset()reset the cursorvoidsetEnableAudit(boolean enableAudit)voidsetImmediatePriorityDispatch(boolean immediatePriorityDispatch)voidsetMaxAuditDepth(int maxAuditDepth)Set the maximum depth of message ids to trackvoidsetMaxBatchSize(int newMaxBatchSize)Set the max batch sizevoidsetMaxProducersToAudit(int maxProducersToAudit)set the maximum number of producers to track at one timevoidsetMemoryUsageHighWaterMark(int memoryUsageHighWaterMark)voidsetSystemUsage(SystemUsage usageManager)Set the UsageManagervoidsetUseCache(boolean useCache)use a cache to improve performanceintsize()voidstart()voidstop()StringtoString()booleantryAddMessageLast(MessageReference node, long wait)add message to await dispatch - if it can-
Methods inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
addMessageLast, destroy, fillBatch, getMaxAuditDepth, getMaxBatchSize, getMaxProducersToAudit, getMemoryUsageHighWaterMark, getMessageAudit, getSystemUsage, hasMessagesBufferedToDeliver, hasSpace, isCacheEnabled, isDuplicate, isEnableAudit, isFull, isPrioritizedMessageSubscriber, isStarted, isUseCache, pageInList, rebase, recordUniqueId, resetForGC, rollback, setCacheEnabled, setMessageAudit
-
-
-
-
Constructor Detail
-
StoreDurableSubscriberCursor
public StoreDurableSubscriberCursor(Broker broker, String clientId, String subscriberName, int maxBatchSize, DurableTopicSubscription subscription)
- Parameters:
broker- Broker for this cursorclientId- clientId for this cursorsubscriberName- subscriber name for this cursormaxBatchSize- currently ignoredsubscription- subscription for this cursor
-
-
Method Detail
-
start
public void start() throws Exception- Specified by:
startin interfaceService- Overrides:
startin classAbstractPendingMessageCursor- Throws:
Exception
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceService- Overrides:
stopin classAbstractPendingMessageCursor- Throws:
Exception
-
add
public void add(ConnectionContext context, Destination destination) throws Exception
Add a destination- Specified by:
addin interfacePendingMessageCursor- Overrides:
addin classAbstractPendingMessageCursor- Parameters:
context-destination-- Throws:
Exception
-
remove
public List<MessageReference> remove(ConnectionContext context, Destination destination) throws Exception
remove a destination- Specified by:
removein interfacePendingMessageCursor- Overrides:
removein classAbstractPendingMessageCursor- Parameters:
context-destination-- Throws:
Exception
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacePendingMessageCursor- Overrides:
isEmptyin classAbstractPendingMessageCursor- Returns:
- true if there are no pending messages
-
isEmpty
public boolean isEmpty(Destination destination)
Description copied from interface:PendingMessageCursorcheck if a Destination is Empty for this cursor- Specified by:
isEmptyin interfacePendingMessageCursor- Overrides:
isEmptyin classAbstractPendingMessageCursor- Returns:
- true id the Destination is empty
-
isRecoveryRequired
public boolean isRecoveryRequired()
Informs the Broker if the subscription needs to intervention to recover it's state e.g. DurableTopicSubscriber may do- Specified by:
isRecoveryRequiredin interfacePendingMessageCursor- Overrides:
isRecoveryRequiredin classAbstractPendingMessageCursor- Returns:
- true if recovery required
- See Also:
AbstractPendingMessageCursor
-
tryAddMessageLast
public boolean tryAddMessageLast(MessageReference node, long wait) throws Exception
Description copied from interface:PendingMessageCursoradd message to await dispatch - if it can- Specified by:
tryAddMessageLastin interfacePendingMessageCursor- Overrides:
tryAddMessageLastin classAbstractPendingMessageCursor- Returns:
- true if successful
- Throws:
IOExceptionException
-
isTransient
public boolean isTransient()
- Specified by:
isTransientin interfacePendingMessageCursor- Overrides:
isTransientin classAbstractPendingMessageCursor- Returns:
- true if the underlying state of this cursor disappears when the broker shuts down
-
addMessageFirst
public void addMessageFirst(MessageReference node) throws Exception
Description copied from interface:PendingMessageCursoradd message to await dispatch- Specified by:
addMessageFirstin interfacePendingMessageCursor- Overrides:
addMessageFirstin classAbstractPendingMessageCursor- Throws:
Exception
-
addRecoveredMessage
public void addRecoveredMessage(MessageReference node) throws Exception
Description copied from interface:PendingMessageCursorAdd a message recovered from a retroactive policy- Specified by:
addRecoveredMessagein interfacePendingMessageCursor- Overrides:
addRecoveredMessagein classAbstractPendingMessageCursor- Throws:
Exception
-
clear
public void clear()
Description copied from interface:PendingMessageCursorclear all pending messages- Specified by:
clearin interfacePendingMessageCursor- Overrides:
clearin classAbstractPendingMessageCursor
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacePendingMessageCursor- Overrides:
hasNextin classAbstractPendingMessageCursor- Returns:
- true if there pending messages to dispatch
-
next
public MessageReference next()
- Specified by:
nextin interfacePendingMessageCursor- Overrides:
nextin classAbstractPendingMessageCursor- Returns:
- the next pending message with its reference count increment
-
remove
public void remove()
Description copied from interface:PendingMessageCursorremove the message at the cursor position- Specified by:
removein interfacePendingMessageCursor- Overrides:
removein classAbstractPendingMessageCursor
-
remove
public void remove(MessageReference node)
Description copied from interface:PendingMessageCursorremove a node- Specified by:
removein interfacePendingMessageCursor- Overrides:
removein classAbstractPendingMessageCursor
-
reset
public void reset()
Description copied from interface:PendingMessageCursorreset the cursor- Specified by:
resetin interfacePendingMessageCursor- Overrides:
resetin classAbstractPendingMessageCursor
-
release
public void release()
Description copied from interface:PendingMessageCursorhint to the cursor to release any locks it might have grabbed after a reset- Specified by:
releasein interfacePendingMessageCursor- Overrides:
releasein classAbstractPendingMessageCursor
-
size
public int size()
- Specified by:
sizein interfacePendingMessageCursor- Overrides:
sizein classAbstractPendingMessageCursor- Returns:
- the number of pending messages
-
messageSize
public long messageSize()
-
setMaxBatchSize
public void setMaxBatchSize(int newMaxBatchSize)
Description copied from interface:PendingMessageCursorSet the max batch size- Specified by:
setMaxBatchSizein interfacePendingMessageCursor- Overrides:
setMaxBatchSizein classAbstractPendingMessageCursor
-
gc
public void gc()
Description copied from interface:PendingMessageCursorfree up any internal buffers- Specified by:
gcin interfacePendingMessageCursor- Overrides:
gcin classAbstractPendingMessageCursor
-
setSystemUsage
public void setSystemUsage(SystemUsage usageManager)
Description copied from interface:PendingMessageCursorSet the UsageManager- Specified by:
setSystemUsagein interfacePendingMessageCursor- Overrides:
setSystemUsagein classAbstractPendingMessageCursor- See Also:
SystemUsage
-
setMemoryUsageHighWaterMark
public void setMemoryUsageHighWaterMark(int memoryUsageHighWaterMark)
- Specified by:
setMemoryUsageHighWaterMarkin interfacePendingMessageCursor- Overrides:
setMemoryUsageHighWaterMarkin classAbstractPendingMessageCursor- Parameters:
memoryUsageHighWaterMark- the memoryUsageHighWaterMark to set
-
setMaxProducersToAudit
public void setMaxProducersToAudit(int maxProducersToAudit)
Description copied from interface:PendingMessageCursorset the maximum number of producers to track at one time- Specified by:
setMaxProducersToAuditin interfacePendingMessageCursor- Overrides:
setMaxProducersToAuditin classAbstractPendingMessageCursor- Parameters:
maxProducersToAudit- the maxProducersToAudit to set
-
setMaxAuditDepth
public void setMaxAuditDepth(int maxAuditDepth)
Description copied from interface:PendingMessageCursorSet the maximum depth of message ids to track- Specified by:
setMaxAuditDepthin interfacePendingMessageCursor- Overrides:
setMaxAuditDepthin classAbstractPendingMessageCursor- Parameters:
maxAuditDepth- the maxAuditDepth to set
-
setEnableAudit
public void setEnableAudit(boolean enableAudit)
- Specified by:
setEnableAuditin interfacePendingMessageCursor- Overrides:
setEnableAuditin classAbstractPendingMessageCursor- Parameters:
enableAudit- the enableAudit to set
-
setUseCache
public void setUseCache(boolean useCache)
Description copied from interface:PendingMessageCursoruse a cache to improve performance- Specified by:
setUseCachein interfacePendingMessageCursor- Overrides:
setUseCachein classAbstractPendingMessageCursor
-
getNextCursor
protected PendingMessageCursor getNextCursor() throws Exception
- Throws:
Exception
-
isImmediatePriorityDispatch
public boolean isImmediatePriorityDispatch()
-
setImmediatePriorityDispatch
public void setImmediatePriorityDispatch(boolean immediatePriorityDispatch)
-
-