org.apache.activemq.broker.region.cursors
Class FilePendingMessageCursor

java.lang.Object
  extended by org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
      extended by 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
protected  Broker broker
           
 
Fields inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
audit, enableAudit, last, maxAuditDepth, maxBatchSize, maxProducersToAudit, memoryUsageHighWaterMark, prioritizedMessages, systemUsage, useCache
 
Constructor Summary
FilePendingMessageCursor(Broker broker, String name, boolean prioritizedMessages)
           
 
Method Summary
 void addMessageFirst(MessageReference node)
          add message to await dispatch
 void addMessageLast(MessageReference node)
          add message to await dispatch
 void clear()
          clear all pending messages
 void destroy()
          destroy the cursor
protected  void expireOldMessages()
           
protected  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()
           
protected  boolean isSpaceInMemoryList()
           
 boolean isTransient()
           
 MessageReference next()
           
 void onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage)
           
 LinkedList<MessageReference> pageInList(int maxItems)
          Page in a restricted number of messages
 void release()
          hint to the cursor to release any locks it might have grabbed after a reset
 void remove()
          remove the message at the cursor position
 void remove(MessageReference node)
          remove a node
 void reset()
          reset the cursor
 void setSystemUsage(SystemUsage usageManager)
          Set the UsageManager
 int size()
           
 void start()
           
 void stop()
           
 boolean tryAddMessageLast(MessageReference node, long maxWaitTime)
          add message to await dispatch - if it can
 
Methods inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
add, addRecoveredMessage, fillBatch, gc, getMaxAuditDepth, getMaxBatchSize, getMaxProducersToAudit, getMemoryUsageHighWaterMark, getMessageAudit, getSystemUsage, hasSpace, isCacheEnabled, isDuplicate, isEmpty, isEnableAudit, isPrioritizedMessageSubscriber, isRecoveryRequired, isStarted, isUseCache, recordUniqueId, remove, resetForGC, rollback, setCacheEnabled, setEnableAudit, setMaxAuditDepth, setMaxBatchSize, setMaxProducersToAudit, setMemoryUsageHighWaterMark, setMessageAudit, setUseCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

broker

protected Broker broker
Constructor Detail

FilePendingMessageCursor

public FilePendingMessageCursor(Broker broker,
                                String name,
                                boolean prioritizedMessages)
Parameters:
broker -
name -
prioritizedMessages -
Method Detail

start

public void start()
           throws Exception
Specified by:
start in interface Service
Overrides:
start in class AbstractPendingMessageCursor
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Service
Overrides:
stop in class AbstractPendingMessageCursor
Throws:
Exception

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface PendingMessageCursor
Overrides:
isEmpty in class AbstractPendingMessageCursor
Returns:
true if there are no pending messages

reset

public void reset()
reset the cursor

Specified by:
reset in interface PendingMessageCursor
Overrides:
reset in class AbstractPendingMessageCursor

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 interface PendingMessageCursor
Overrides:
release in class AbstractPendingMessageCursor

destroy

public void destroy()
             throws Exception
Description copied from class: AbstractPendingMessageCursor
destroy the cursor

Specified by:
destroy in interface PendingMessageCursor
Overrides:
destroy in class AbstractPendingMessageCursor
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 interface PendingMessageCursor
Overrides:
pageInList in class AbstractPendingMessageCursor
Parameters:
maxItems - maximum number of messages to return
Returns:
a list of paged in messages

addMessageLast

public void addMessageLast(MessageReference node)
                    throws Exception
add message to await dispatch

Specified by:
addMessageLast in interface PendingMessageCursor
Overrides:
addMessageLast in class AbstractPendingMessageCursor
Parameters:
node -
Throws:
Exception
IOException

tryAddMessageLast

public boolean tryAddMessageLast(MessageReference node,
                                 long maxWaitTime)
                          throws Exception
Description copied from interface: PendingMessageCursor
add message to await dispatch - if it can

Specified by:
tryAddMessageLast in interface PendingMessageCursor
Overrides:
tryAddMessageLast in class AbstractPendingMessageCursor
Returns:
true if successful
Throws:
IOException
Exception

addMessageFirst

public void addMessageFirst(MessageReference node)
add message to await dispatch

Specified by:
addMessageFirst in interface PendingMessageCursor
Overrides:
addMessageFirst in class AbstractPendingMessageCursor
Parameters:
node -

hasNext

public boolean hasNext()
Specified by:
hasNext in interface PendingMessageCursor
Overrides:
hasNext in class AbstractPendingMessageCursor
Returns:
true if there pending messages to dispatch

next

public MessageReference next()
Specified by:
next in interface PendingMessageCursor
Overrides:
next in class AbstractPendingMessageCursor
Returns:
the next pending message

remove

public void remove()
remove the message at the cursor position

Specified by:
remove in interface PendingMessageCursor
Overrides:
remove in class AbstractPendingMessageCursor

remove

public void remove(MessageReference node)
Description copied from interface: PendingMessageCursor
remove a node

Specified by:
remove in interface PendingMessageCursor
Overrides:
remove in class AbstractPendingMessageCursor
Parameters:
node -
See Also:
AbstractPendingMessageCursor.remove(org.apache.activemq.broker.region.MessageReference)

size

public int size()
Specified by:
size in interface PendingMessageCursor
Overrides:
size in class AbstractPendingMessageCursor
Returns:
the number of pending messages

clear

public void clear()
clear all pending messages

Specified by:
clear in interface PendingMessageCursor
Overrides:
clear in class AbstractPendingMessageCursor

isFull

public boolean isFull()
Specified by:
isFull in interface PendingMessageCursor
Overrides:
isFull in class AbstractPendingMessageCursor
Returns:
true if the cursor is full

hasMessagesBufferedToDeliver

public boolean hasMessagesBufferedToDeliver()
Specified by:
hasMessagesBufferedToDeliver in interface PendingMessageCursor
Overrides:
hasMessagesBufferedToDeliver in class AbstractPendingMessageCursor
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 interface PendingMessageCursor
Overrides:
setSystemUsage in class AbstractPendingMessageCursor
See Also:
SystemUsage

onUsageChanged

public void onUsageChanged(Usage usage,
                           int oldPercentUsage,
                           int newPercentUsage)
Specified by:
onUsageChanged in interface UsageListener

isTransient

public boolean isTransient()
Specified by:
isTransient in interface PendingMessageCursor
Overrides:
isTransient in class AbstractPendingMessageCursor
Returns:
true if the underlying state of this cursor disappears when the broker shuts down

isSpaceInMemoryList

protected boolean isSpaceInMemoryList()

expireOldMessages

protected void expireOldMessages()

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


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.