Class FilePendingMessageCursor
- java.lang.Object
-
- org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
-
- org.apache.activemq.broker.region.cursors.FilePendingMessageCursor
-
- All Implemented Interfaces:
PendingMessageCursor
,Service
,UsageListener
public class FilePendingMessageCursor extends AbstractPendingMessageCursor implements UsageListener
persist pending messages pending message (messages awaiting dispatch to a consumer) cursor
-
-
Field Summary
Fields Modifier and Type Field Description protected Broker
broker
-
Fields inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
audit, cacheEnabled, enableAudit, last, maxAuditDepth, maxBatchSize, maxProducersToAudit, memoryUsageHighWaterMark, prioritizedMessages, systemUsage, useCache
-
Fields inherited from interface org.apache.activemq.broker.region.cursors.PendingMessageCursor
INFINITE_WAIT
-
-
Constructor Summary
Constructors Constructor Description FilePendingMessageCursor(Broker broker, String name, boolean prioritizedMessages)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessageFirst(MessageReference node)
add message to await dispatchvoid
clear()
clear all pending messagesvoid
destroy()
destroy the cursorprotected void
flushToDisk()
protected ByteSequence
getByteSequence(Message message)
PList
getDiskList()
protected Message
getMessage(ByteSequence bs)
boolean
hasMessagesBufferedToDeliver()
boolean
hasNext()
protected boolean
isDiskListEmpty()
boolean
isEmpty()
boolean
isFull()
boolean
isTransient()
long
messageSize()
MessageReference
next()
void
onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage)
LinkedList<MessageReference>
pageInList(int maxItems)
Page in a restricted number of messagesvoid
release()
hint to the cursor to release any locks it might have grabbed after a resetvoid
remove()
remove the message at the cursor positionvoid
remove(MessageReference node)
remove a nodevoid
reset()
reset the cursorvoid
setSystemUsage(SystemUsage usageManager)
Set the UsageManagerint
size()
void
start()
void
stop()
boolean
tryAddMessageLast(MessageReference node, long maxWaitTime)
add message to await dispatch-
Methods inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
add, addMessageLast, addRecoveredMessage, fillBatch, gc, getMaxAuditDepth, getMaxBatchSize, getMaxProducersToAudit, getMemoryUsageHighWaterMark, getMessageAudit, getSystemUsage, hasSpace, isCacheEnabled, isDuplicate, isEmpty, isEnableAudit, isPrioritizedMessageSubscriber, isRecoveryRequired, isStarted, isUseCache, rebase, recordUniqueId, remove, resetForGC, rollback, setCacheEnabled, setEnableAudit, setMaxAuditDepth, setMaxBatchSize, setMaxProducersToAudit, setMemoryUsageHighWaterMark, setMessageAudit, setUseCache
-
-
-
-
Field Detail
-
broker
protected Broker broker
-
-
Method Detail
-
start
public void start() throws Exception
- Specified by:
start
in interfaceService
- Overrides:
start
in classAbstractPendingMessageCursor
- Throws:
Exception
-
stop
public void stop() throws Exception
- Specified by:
stop
in interfaceService
- Overrides:
stop
in classAbstractPendingMessageCursor
- Throws:
Exception
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacePendingMessageCursor
- Overrides:
isEmpty
in classAbstractPendingMessageCursor
- Returns:
- true if there are no pending messages
-
reset
public void reset()
reset the cursor- Specified by:
reset
in interfacePendingMessageCursor
- Overrides:
reset
in classAbstractPendingMessageCursor
-
release
public void release()
Description copied from interface:PendingMessageCursor
hint to the cursor to release any locks it might have grabbed after a reset- Specified by:
release
in interfacePendingMessageCursor
- Overrides:
release
in classAbstractPendingMessageCursor
-
destroy
public void destroy() throws Exception
Description copied from class:AbstractPendingMessageCursor
destroy the cursor- Specified by:
destroy
in interfacePendingMessageCursor
- Overrides:
destroy
in classAbstractPendingMessageCursor
- Throws:
Exception
-
pageInList
public LinkedList<MessageReference> pageInList(int maxItems)
Description copied from class:AbstractPendingMessageCursor
Page in a restricted number of messages- Specified by:
pageInList
in interfacePendingMessageCursor
- Overrides:
pageInList
in classAbstractPendingMessageCursor
- Parameters:
maxItems
- maximum number of messages to return- Returns:
- a list of paged in messages
-
tryAddMessageLast
public boolean tryAddMessageLast(MessageReference node, long maxWaitTime) throws Exception
add message to await dispatch- Specified by:
tryAddMessageLast
in interfacePendingMessageCursor
- Overrides:
tryAddMessageLast
in classAbstractPendingMessageCursor
- Parameters:
node
-- Returns:
- true if successful
- Throws:
Exception
IOException
-
addMessageFirst
public void addMessageFirst(MessageReference node)
add message to await dispatch- Specified by:
addMessageFirst
in interfacePendingMessageCursor
- Overrides:
addMessageFirst
in classAbstractPendingMessageCursor
- Parameters:
node
-
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacePendingMessageCursor
- Overrides:
hasNext
in classAbstractPendingMessageCursor
- Returns:
- true if there pending messages to dispatch
-
next
public MessageReference next()
- Specified by:
next
in interfacePendingMessageCursor
- Overrides:
next
in classAbstractPendingMessageCursor
- Returns:
- the next pending message
-
remove
public void remove()
remove the message at the cursor position- Specified by:
remove
in interfacePendingMessageCursor
- Overrides:
remove
in classAbstractPendingMessageCursor
-
remove
public void remove(MessageReference node)
Description copied from interface:PendingMessageCursor
remove a node- Specified by:
remove
in interfacePendingMessageCursor
- Overrides:
remove
in classAbstractPendingMessageCursor
- Parameters:
node
-- See Also:
AbstractPendingMessageCursor.remove(org.apache.activemq.broker.region.MessageReference)
-
size
public int size()
- Specified by:
size
in interfacePendingMessageCursor
- Overrides:
size
in classAbstractPendingMessageCursor
- Returns:
- the number of pending messages
-
messageSize
public long messageSize()
- Specified by:
messageSize
in interfacePendingMessageCursor
-
clear
public void clear()
clear all pending messages- Specified by:
clear
in interfacePendingMessageCursor
- Overrides:
clear
in classAbstractPendingMessageCursor
-
isFull
public boolean isFull()
- Specified by:
isFull
in interfacePendingMessageCursor
- Overrides:
isFull
in classAbstractPendingMessageCursor
- Returns:
- true if the cursor is full
-
hasMessagesBufferedToDeliver
public boolean hasMessagesBufferedToDeliver()
- Specified by:
hasMessagesBufferedToDeliver
in interfacePendingMessageCursor
- Overrides:
hasMessagesBufferedToDeliver
in classAbstractPendingMessageCursor
- Returns:
- true if the cursor has buffered messages ready to deliver
-
setSystemUsage
public void setSystemUsage(SystemUsage usageManager)
Description copied from interface:PendingMessageCursor
Set the UsageManager- Specified by:
setSystemUsage
in interfacePendingMessageCursor
- Overrides:
setSystemUsage
in classAbstractPendingMessageCursor
- See Also:
SystemUsage
-
onUsageChanged
public void onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage)
- Specified by:
onUsageChanged
in interfaceUsageListener
-
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interfacePendingMessageCursor
- Overrides:
isTransient
in classAbstractPendingMessageCursor
- Returns:
- true if the underlying state of this cursor disappears when the broker shuts down
-
flushToDisk
protected void flushToDisk()
-
isDiskListEmpty
protected boolean isDiskListEmpty()
-
getDiskList
public PList getDiskList()
-
getByteSequence
protected ByteSequence getByteSequence(Message message) throws IOException
- Throws:
IOException
-
getMessage
protected Message getMessage(ByteSequence bs) throws IOException
- Throws:
IOException
-
-