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
Abstract method holder for pending message (messages awaiting disptach to a
consumer) cursor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.activemq.ActiveMQMessageAuditprotected booleanprotected booleanprotected org.apache.activemq.broker.region.MessageReferenceprotected intprotected intprotected intprotected intprotected final booleanprotected booleanprotected SystemUsageprotected booleanFields inherited from interface org.apache.activemq.broker.region.cursors.PendingMessageCursor
INFINITE_WAIT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(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 voidvoidgc()free up any internal buffersintintintintorg.apache.activemq.ActiveMQMessageAuditbooleanbooleanhasNext()booleanhasSpace()booleanbooleanisDuplicate(org.apache.activemq.command.MessageId messageId) booleanisEmpty()booleanisEmpty(Destination destination) check if a Destination is Empty for this cursorbooleanbooleanisFull()static booleanisPrioritizedMessageSubscriber(Broker broker, Subscription sub) booleanInforms the Broker if the subscription needs to intervention to recover it's state e.g.booleanbooleanbooleanorg.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 cursorvoidGive 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 canMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.broker.region.cursors.PendingMessageCursor
messageSize
-
Field Details
-
memoryUsageHighWaterMark
protected int memoryUsageHighWaterMark -
maxBatchSize
protected int maxBatchSize -
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
-
-
Constructor Details
-
AbstractPendingMessageCursor
public AbstractPendingMessageCursor(boolean prioritizedMessages)
-
-
Method Details
-
start
- Specified by:
startin interfaceorg.apache.activemq.Service- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.apache.activemq.Service- Throws:
Exception
-
add
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 Exception Description 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 Exception Description 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 Exception Description 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 Exception Description 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
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
-
fillBatch
- Throws:
Exception
-
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
Description copied from interface:PendingMessageCursorSet the UsageManager- Specified by:
setSystemUsagein interfacePendingMessageCursor- See Also:
-
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
- Specified by:
getSystemUsagein interfacePendingMessageCursor- Returns:
- the usageManager
-
destroy
destroy the cursor- Specified by:
destroyin interfacePendingMessageCursor- Throws:
Exception
-
pageInList
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
-
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
-