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

java.lang.Object
  extended by org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
      extended by org.apache.activemq.broker.region.cursors.AbstractStoreCursor
All Implemented Interfaces:
PendingMessageCursor, Service, MessageRecoveryListener

public abstract class AbstractStoreCursor
extends AbstractPendingMessageCursor
implements MessageRecoveryListener

Store based cursor


Field Summary
protected  PendingList batchList
           
protected  boolean batchResetNeeded
           
protected  Destination regionDestination
           
protected  int size
           
 
Fields inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
audit, enableAudit, last, maxAuditDepth, maxBatchSize, maxProducersToAudit, memoryUsageHighWaterMark, prioritizedMessages, systemUsage, useCache
 
Constructor Summary
protected AbstractStoreCursor(Destination destination)
           
 
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
protected abstract  void doFillBatch()
           
protected  void fillBatch()
           
 void finished()
           
 void gc()
          free up any internal buffers
protected abstract  int getStoreSize()
           
 boolean hasMessagesBufferedToDeliver()
           
 boolean hasNext()
           
 boolean hasSpace()
           
 boolean isEmpty()
           
protected abstract  boolean isStoreEmpty()
           
 MessageReference next()
           
 boolean recoverMessage(Message message)
           
 boolean recoverMessage(Message message, boolean cached)
           
 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
protected abstract  void resetBatch()
           
protected  void resetSize()
           
protected  void setBatch(MessageId messageId)
           
 int size()
           
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
add, addRecoveredMessage, destroy, getMaxAuditDepth, getMaxBatchSize, getMaxProducersToAudit, getMemoryUsageHighWaterMark, getMessageAudit, getSystemUsage, isCacheEnabled, isDuplicate, isEmpty, isEnableAudit, isFull, isPrioritizedMessageSubscriber, isRecoveryRequired, isStarted, isTransient, isUseCache, pageInList, recordUniqueId, remove, resetForGC, rollback, setCacheEnabled, setEnableAudit, setMaxAuditDepth, setMaxBatchSize, setMaxProducersToAudit, setMemoryUsageHighWaterMark, setMessageAudit, setSystemUsage, setUseCache, tryAddMessageLast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.store.MessageRecoveryListener
isDuplicate, recoverMessageReference
 

Field Detail

regionDestination

protected final Destination regionDestination

batchList

protected final PendingList batchList

batchResetNeeded

protected boolean batchResetNeeded

size

protected int size
Constructor Detail

AbstractStoreCursor

protected AbstractStoreCursor(Destination destination)
Method Detail

start

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

resetSize

protected void resetSize()

stop

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

recoverMessage

public final boolean recoverMessage(Message message)
                             throws Exception
Specified by:
recoverMessage in interface MessageRecoveryListener
Throws:
Exception

recoverMessage

public boolean recoverMessage(Message message,
                              boolean cached)
                       throws Exception
Throws:
Exception

reset

public final void reset()
Description copied from interface: PendingMessageCursor
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

finished

public final void finished()

hasNext

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

next

public final MessageReference next()
Specified by:
next in interface PendingMessageCursor
Overrides:
next in class AbstractPendingMessageCursor
Returns:
the next pending message with its reference count increment

addMessageLast

public final void addMessageLast(MessageReference node)
                          throws Exception
Description copied from interface: PendingMessageCursor
add message to await dispatch

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

setBatch

protected void setBatch(MessageId messageId)
                 throws Exception
Throws:
Exception

addMessageFirst

public final void addMessageFirst(MessageReference node)
                           throws Exception
Description copied from interface: PendingMessageCursor
add message to await dispatch

Specified by:
addMessageFirst in interface PendingMessageCursor
Overrides:
addMessageFirst in class AbstractPendingMessageCursor
Throws:
Exception

remove

public final void remove()
Description copied from interface: PendingMessageCursor
remove the message at the cursor position

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

remove

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

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

clear

public final void clear()
Description copied from interface: PendingMessageCursor
clear all pending messages

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

gc

public void gc()
Description copied from interface: PendingMessageCursor
free up any internal buffers

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

hasSpace

public boolean hasSpace()
Specified by:
hasSpace in interface PendingMessageCursor
Specified by:
hasSpace in interface MessageRecoveryListener
Overrides:
hasSpace in class AbstractPendingMessageCursor
Returns:
true if the cursor has space to page messages into

fillBatch

protected final void fillBatch()
Overrides:
fillBatch in class AbstractPendingMessageCursor

isEmpty

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

hasMessagesBufferedToDeliver

public final boolean hasMessagesBufferedToDeliver()
Specified by:
hasMessagesBufferedToDeliver in interface PendingMessageCursor
Overrides:
hasMessagesBufferedToDeliver in class AbstractPendingMessageCursor
Returns:
true if the cursor has buffered messages ready to deliver

size

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

toString

public String toString()
Overrides:
toString in class Object

doFillBatch

protected abstract void doFillBatch()
                             throws Exception
Throws:
Exception

resetBatch

protected abstract void resetBatch()

getStoreSize

protected abstract int getStoreSize()

isStoreEmpty

protected abstract boolean isStoreEmpty()


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.