Class AbstractPendingMessageCursor
- java.lang.Object
-
- org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
-
- All Implemented Interfaces:
PendingMessageCursor,org.apache.activemq.Service
- Direct Known Subclasses:
AbstractStoreCursor,FilePendingMessageCursor,StoreDurableSubscriberCursor,StoreQueueCursor,VMPendingMessageCursor
public abstract class AbstractPendingMessageCursor extends Object implements PendingMessageCursor
Abstract method holder for pending message (messages awaiting disptach to a consumer) cursor
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.activemq.ActiveMQMessageAuditauditprotected booleancacheEnabledprotected booleanenableAuditprotected org.apache.activemq.broker.region.MessageReferencelastprotected intmaxAuditDepthprotected intmaxBatchSizeprotected intmaxProducersToAuditprotected intmemoryUsageHighWaterMarkprotected booleanprioritizedMessagesprotected booleanstartedprotected SystemUsagesystemUsageprotected booleanuseCache-
Fields inherited from interface org.apache.activemq.broker.region.cursors.PendingMessageCursor
INFINITE_WAIT
-
-
Constructor Summary
Constructors Constructor Description AbstractPendingMessageCursor(boolean prioritizedMessages)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ConnectionContext context, Destination destination)Add a destinationvoidaddMessageFirst(org.apache.activemq.broker.region.MessageReference node)add message to await dispatchbooleanaddMessageLast(org.apache.activemq.broker.region.MessageReference node)add message to await dispatchvoidaddRecoveredMessage(org.apache.activemq.broker.region.MessageReference node)Add a message recovered from a retroactive policyvoidclear()clear all pending messagesvoiddestroy()destroy the cursorprotected voidfillBatch()voidgc()free up any internal buffersintgetMaxAuditDepth()intgetMaxBatchSize()intgetMaxProducersToAudit()intgetMemoryUsageHighWaterMark()org.apache.activemq.ActiveMQMessageAuditgetMessageAudit()SystemUsagegetSystemUsage()booleanhasMessagesBufferedToDeliver()booleanhasNext()booleanhasSpace()booleanisCacheEnabled()booleanisDuplicate(org.apache.activemq.command.MessageId messageId)booleanisEmpty()booleanisEmpty(Destination destination)check if a Destination is Empty for this cursorbooleanisEnableAudit()booleanisFull()static booleanisPrioritizedMessageSubscriber(Broker broker, Subscription sub)booleanisRecoveryRequired()Informs the Broker if the subscription needs to intervention to recover it's state e.g.booleanisStarted()booleanisTransient()booleanisUseCache()org.apache.activemq.broker.region.MessageReferencenext()LinkedList<org.apache.activemq.broker.region.MessageReference>pageInList(int maxItems)Page in a restricted number of messagesvoidrebase()booleanrecordUniqueId(org.apache.activemq.command.MessageId messageId)records a message id and checks if it is a duplicatevoidrelease()hint to the cursor to release any locks it might have grabbed after a resetvoidremove()remove the message at the cursor positionList<org.apache.activemq.broker.region.MessageReference>remove(ConnectionContext context, Destination destination)remove a destinationvoidremove(org.apache.activemq.broker.region.MessageReference node)remove a nodevoidreset()reset the cursorvoidresetForGC()Give the cursor a hint that we are about to remove messages from memory onlyvoidrollback(org.apache.activemq.command.MessageId id)remove from auditing the message idvoidsetCacheEnabled(boolean val)voidsetEnableAudit(boolean enableAudit)voidsetMaxAuditDepth(int maxAuditDepth)Set the maximum depth of message ids to trackvoidsetMaxBatchSize(int maxBatchSize)Set the max batch sizevoidsetMaxProducersToAudit(int maxProducersToAudit)set the maximum number of producers to track at one timevoidsetMemoryUsageHighWaterMark(int memoryUsageHighWaterMark)voidsetMessageAudit(org.apache.activemq.ActiveMQMessageAudit audit)set the auditvoidsetSystemUsage(SystemUsage usageManager)Set the UsageManagervoidsetUseCache(boolean useCache)use a cache to improve performanceintsize()voidstart()voidstop()booleantryAddMessageLast(org.apache.activemq.broker.region.MessageReference node, long maxWaitTime)add message to await dispatch - if it can-
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.cursors.PendingMessageCursor
messageSize
-
-
-
-
Field Detail
-
memoryUsageHighWaterMark
protected int memoryUsageHighWaterMark
-
maxBatchSize
protected int maxBatchSize
-
systemUsage
protected SystemUsage systemUsage
-
maxProducersToAudit
protected int maxProducersToAudit
-
maxAuditDepth
protected int maxAuditDepth
-
enableAudit
protected boolean enableAudit
-
audit
protected org.apache.activemq.ActiveMQMessageAudit audit
-
useCache
protected boolean useCache
-
cacheEnabled
protected boolean cacheEnabled
-
started
protected boolean started
-
last
protected org.apache.activemq.broker.region.MessageReference last
-
prioritizedMessages
protected final boolean prioritizedMessages
-
-
Method Detail
-
start
public void start() throws Exception- Specified by:
startin interfaceorg.apache.activemq.Service- Throws:
Exception
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceorg.apache.activemq.Service- Throws:
Exception
-
add
public void add(ConnectionContext context, Destination destination) throws Exception
Description copied from interface:PendingMessageCursorAdd a destination- Specified by:
addin interfacePendingMessageCursor- Throws:
Exception
-
remove
public List<org.apache.activemq.broker.region.MessageReference> remove(ConnectionContext context, Destination destination) throws Exception
Description copied from interface:PendingMessageCursorremove a destination- Specified by:
removein interfacePendingMessageCursor- Throws:
Exception
-
isRecoveryRequired
public boolean isRecoveryRequired()
Description copied from interface:PendingMessageCursorInforms the Broker if the subscription needs to intervention to recover it's state e.g. DurableTopicSubscriber may do- Specified by:
isRecoveryRequiredin interfacePendingMessageCursor- Returns:
- true if recovery required
-
addMessageFirst
public void addMessageFirst(org.apache.activemq.broker.region.MessageReference node) throws ExceptionDescription copied from interface:PendingMessageCursoradd message to await dispatch- Specified by:
addMessageFirstin interfacePendingMessageCursor- Throws:
Exception
-
addMessageLast
public boolean addMessageLast(org.apache.activemq.broker.region.MessageReference node) throws ExceptionDescription copied from interface:PendingMessageCursoradd message to await dispatch- Specified by:
addMessageLastin interfacePendingMessageCursor- Returns:
- boolean true if successful, false if cursor traps a duplicate
- Throws:
IOExceptionException
-
tryAddMessageLast
public boolean tryAddMessageLast(org.apache.activemq.broker.region.MessageReference node, long maxWaitTime) throws ExceptionDescription copied from interface:PendingMessageCursoradd message to await dispatch - if it can- Specified by:
tryAddMessageLastin interfacePendingMessageCursor- Returns:
- true if successful
- Throws:
IOExceptionException
-
addRecoveredMessage
public void addRecoveredMessage(org.apache.activemq.broker.region.MessageReference node) throws ExceptionDescription copied from interface:PendingMessageCursorAdd a message recovered from a retroactive policy- Specified by:
addRecoveredMessagein interfacePendingMessageCursor- Throws:
Exception
-
clear
public void clear()
Description copied from interface:PendingMessageCursorclear all pending messages- Specified by:
clearin interfacePendingMessageCursor
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacePendingMessageCursor- Returns:
- true if there pending messages to dispatch
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacePendingMessageCursor- 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- Returns:
- true id the Destination is empty
-
next
public org.apache.activemq.broker.region.MessageReference next()
- Specified by:
nextin interfacePendingMessageCursor- 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
-
reset
public void reset()
Description copied from interface:PendingMessageCursorreset the cursor- Specified by:
resetin interfacePendingMessageCursor
-
size
public int size()
- Specified by:
sizein interfacePendingMessageCursor- Returns:
- the number of pending messages
-
getMaxBatchSize
public int getMaxBatchSize()
- Specified by:
getMaxBatchSizein interfacePendingMessageCursor- Returns:
- the maximum batch size
-
setMaxBatchSize
public void setMaxBatchSize(int maxBatchSize)
Description copied from interface:PendingMessageCursorSet the max batch size- Specified by:
setMaxBatchSizein interfacePendingMessageCursor
-
resetForGC
public void resetForGC()
Description copied from interface:PendingMessageCursorGive the cursor a hint that we are about to remove messages from memory only- Specified by:
resetForGCin interfacePendingMessageCursor
-
remove
public void remove(org.apache.activemq.broker.region.MessageReference node)
Description copied from interface:PendingMessageCursorremove a node- Specified by:
removein interfacePendingMessageCursor
-
gc
public void gc()
Description copied from interface:PendingMessageCursorfree up any internal buffers- Specified by:
gcin interfacePendingMessageCursor
-
setSystemUsage
public void setSystemUsage(SystemUsage usageManager)
Description copied from interface:PendingMessageCursorSet the UsageManager- Specified by:
setSystemUsagein interfacePendingMessageCursor- See Also:
SystemUsage
-
hasSpace
public boolean hasSpace()
- Specified by:
hasSpacein interfacePendingMessageCursor- Returns:
- true if the cursor has space to page messages into
-
isFull
public boolean isFull()
- Specified by:
isFullin interfacePendingMessageCursor- Returns:
- true if the cursor is full
-
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
-
hasMessagesBufferedToDeliver
public boolean hasMessagesBufferedToDeliver()
- Specified by:
hasMessagesBufferedToDeliverin interfacePendingMessageCursor- Returns:
- true if the cursor has buffered messages ready to deliver
-
getMemoryUsageHighWaterMark
public int getMemoryUsageHighWaterMark()
- Specified by:
getMemoryUsageHighWaterMarkin interfacePendingMessageCursor- Returns:
- the memoryUsageHighWaterMark
-
setMemoryUsageHighWaterMark
public void setMemoryUsageHighWaterMark(int memoryUsageHighWaterMark)
- Specified by:
setMemoryUsageHighWaterMarkin interfacePendingMessageCursor- Parameters:
memoryUsageHighWaterMark- the memoryUsageHighWaterMark to set
-
getSystemUsage
public SystemUsage getSystemUsage()
- Specified by:
getSystemUsagein interfacePendingMessageCursor- Returns:
- the usageManager
-
destroy
public void destroy() throws Exceptiondestroy the cursor- Specified by:
destroyin interfacePendingMessageCursor- Throws:
Exception
-
pageInList
public LinkedList<org.apache.activemq.broker.region.MessageReference> pageInList(int maxItems)
Page in a restricted number of messages- Specified by:
pageInListin interfacePendingMessageCursor- Parameters:
maxItems- maximum number of messages to return- Returns:
- a list of paged in messages
-
getMaxProducersToAudit
public int getMaxProducersToAudit()
- Specified by:
getMaxProducersToAuditin interfacePendingMessageCursor- Returns:
- the maxProducersToAudit
-
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- Parameters:
maxProducersToAudit- the maxProducersToAudit to set
-
getMaxAuditDepth
public int getMaxAuditDepth()
- Specified by:
getMaxAuditDepthin interfacePendingMessageCursor- Returns:
- the maxAuditDepth
-
setMaxAuditDepth
public void setMaxAuditDepth(int maxAuditDepth)
Description copied from interface:PendingMessageCursorSet the maximum depth of message ids to track- Specified by:
setMaxAuditDepthin interfacePendingMessageCursor- Parameters:
maxAuditDepth- the maxAuditDepth to set
-
isEnableAudit
public boolean isEnableAudit()
- Specified by:
isEnableAuditin interfacePendingMessageCursor- Returns:
- the enableAudit
-
setEnableAudit
public void setEnableAudit(boolean enableAudit)
- Specified by:
setEnableAuditin interfacePendingMessageCursor- Parameters:
enableAudit- the enableAudit to set
-
isTransient
public boolean isTransient()
- Specified by:
isTransientin interfacePendingMessageCursor- Returns:
- true if the underlying state of this cursor disappears when the broker shuts down
-
setMessageAudit
public void setMessageAudit(org.apache.activemq.ActiveMQMessageAudit audit)
set the audit- Specified by:
setMessageAuditin interfacePendingMessageCursor- Parameters:
audit- new audit component
-
getMessageAudit
public org.apache.activemq.ActiveMQMessageAudit getMessageAudit()
- Specified by:
getMessageAuditin interfacePendingMessageCursor- Returns:
- the audit
-
isUseCache
public boolean isUseCache()
- Specified by:
isUseCachein interfacePendingMessageCursor- Returns:
- true if a cache may be used
-
setUseCache
public void setUseCache(boolean useCache)
Description copied from interface:PendingMessageCursoruse a cache to improve performance- Specified by:
setUseCachein interfacePendingMessageCursor
-
isDuplicate
public boolean isDuplicate(org.apache.activemq.command.MessageId messageId)
-
recordUniqueId
public boolean recordUniqueId(org.apache.activemq.command.MessageId messageId)
records a message id and checks if it is a duplicate- Parameters:
messageId-- Returns:
- true if id is unique, false otherwise.
-
rollback
public void rollback(org.apache.activemq.command.MessageId id)
Description copied from interface:PendingMessageCursorremove from auditing the message id- Specified by:
rollbackin interfacePendingMessageCursor
-
isStarted
public boolean isStarted()
-
isPrioritizedMessageSubscriber
public static boolean isPrioritizedMessageSubscriber(Broker broker, Subscription sub)
-
isCacheEnabled
public boolean isCacheEnabled()
- Specified by:
isCacheEnabledin interfacePendingMessageCursor- Returns:
- true if cache is being used
-
setCacheEnabled
public void setCacheEnabled(boolean val)
-
rebase
public void rebase()
- Specified by:
rebasein interfacePendingMessageCursor
-
-