Class AbstractStoreCursor
- java.lang.Object
-
- org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
-
- 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
Fields Modifier and Type Field Description protected PendingListbatchListprotected booleanbatchResetNeededprotected booleanhadSpaceprotected DestinationregionDestinationprotected intsize-
Fields inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
audit, cacheEnabled, enableAudit, last, maxAuditDepth, maxBatchSize, maxProducersToAudit, memoryUsageHighWaterMark, prioritizedMessages, started, systemUsage, useCache
-
Fields inherited from interface org.apache.activemq.broker.region.cursors.PendingMessageCursor
INFINITE_WAIT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStoreCursor(Destination destination)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMessageFirst(MessageReference node)add message to await dispatchprotected booleancanEnableCash()booleancanRecoveryNextMessage()voidclear()clear all pending messagesprotected abstract voiddoFillBatch()protected booleanduplicateFromStoreExcepted(Message message)protected booleanenableCacheNow()protected voidfillBatch()voidfinished()voidgc()free up any internal buffersprotected abstract longgetStoreMessageSize()protected abstract intgetStoreSize()SubscriptiongetSubscription()static booleangotToTheStore(Message message)booleanhasMessagesBufferedToDeliver()booleanhasNext()booleanisCacheEnabled()booleanisEmpty()protected abstract booleanisStoreEmpty()longmessageSize()MessageReferencenext()voidrebase()booleanrecoverMessage(Message message)booleanrecoverMessage(Message message, boolean cached)voidrelease()hint to the cursor to release any locks it might have grabbed after a resetvoidremove()remove the message at the cursor positionvoidremove(MessageReference node)remove a nodevoidreset()reset the cursorprotected abstract voidresetBatch()protected voidresetSize()protected voidsetBatch(MessageId messageId)intsize()voidstart()voidstop()StringtoString()booleantryAddMessageLast(MessageReference node, long wait)add message to await dispatch - if it can-
Methods inherited from class org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursor
add, addMessageLast, addRecoveredMessage, destroy, getMaxAuditDepth, getMaxBatchSize, getMaxProducersToAudit, getMemoryUsageHighWaterMark, getMessageAudit, getSystemUsage, hasSpace, isDuplicate, isEmpty, isEnableAudit, isFull, isPrioritizedMessageSubscriber, isRecoveryRequired, isStarted, isTransient, isUseCache, pageInList, recordUniqueId, remove, resetForGC, rollback, setCacheEnabled, setEnableAudit, setMaxAuditDepth, setMaxBatchSize, setMaxProducersToAudit, setMemoryUsageHighWaterMark, setMessageAudit, setSystemUsage, setUseCache
-
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
hasSpace, isDuplicate, recoverMessageReference
-
-
-
-
Field Detail
-
regionDestination
protected final Destination regionDestination
-
batchList
protected final PendingList batchList
-
batchResetNeeded
protected boolean batchResetNeeded
-
size
protected int size
-
hadSpace
protected boolean hadSpace
-
-
Constructor Detail
-
AbstractStoreCursor
protected AbstractStoreCursor(Destination destination)
-
-
Method Detail
-
start
public final void start() throws Exception- Specified by:
startin interfaceService- Overrides:
startin classAbstractPendingMessageCursor- Throws:
Exception
-
resetSize
protected void resetSize()
-
rebase
public void rebase()
- Specified by:
rebasein interfacePendingMessageCursor- Overrides:
rebasein classAbstractPendingMessageCursor
-
stop
public final void stop() throws Exception- Specified by:
stopin interfaceService- Overrides:
stopin classAbstractPendingMessageCursor- Throws:
Exception
-
recoverMessage
public final boolean recoverMessage(Message message) throws Exception
- Specified by:
recoverMessagein interfaceMessageRecoveryListener- Throws:
Exception
-
recoverMessage
public boolean recoverMessage(Message message, boolean cached) throws Exception
- Throws:
Exception
-
duplicateFromStoreExcepted
protected boolean duplicateFromStoreExcepted(Message message)
-
gotToTheStore
public static boolean gotToTheStore(Message message) throws Exception
- Throws:
Exception
-
reset
public final void reset()
Description copied from interface:PendingMessageCursorreset the cursor- Specified by:
resetin interfacePendingMessageCursor- Overrides:
resetin classAbstractPendingMessageCursor
-
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- Overrides:
releasein classAbstractPendingMessageCursor
-
finished
public final void finished()
-
hasNext
public final boolean hasNext()
- Specified by:
hasNextin interfacePendingMessageCursor- Overrides:
hasNextin classAbstractPendingMessageCursor- Returns:
- true if there pending messages to dispatch
-
next
public final MessageReference next()
- Specified by:
nextin interfacePendingMessageCursor- Overrides:
nextin classAbstractPendingMessageCursor- Returns:
- the next pending message with its reference count increment
-
tryAddMessageLast
public boolean tryAddMessageLast(MessageReference node, long wait) throws Exception
Description copied from interface:PendingMessageCursoradd message to await dispatch - if it can- Specified by:
tryAddMessageLastin interfacePendingMessageCursor- Overrides:
tryAddMessageLastin classAbstractPendingMessageCursor- Returns:
- true if successful
- Throws:
IOExceptionException
-
isCacheEnabled
public boolean isCacheEnabled()
- Specified by:
isCacheEnabledin interfacePendingMessageCursor- Overrides:
isCacheEnabledin classAbstractPendingMessageCursor- Returns:
- true if cache is being used
-
enableCacheNow
protected boolean enableCacheNow()
-
canEnableCash
protected boolean canEnableCash()
-
canRecoveryNextMessage
public boolean canRecoveryNextMessage()
- Specified by:
canRecoveryNextMessagein interfaceMessageRecoveryListener
-
addMessageFirst
public void addMessageFirst(MessageReference node) throws Exception
Description copied from interface:PendingMessageCursoradd message to await dispatch- Specified by:
addMessageFirstin interfacePendingMessageCursor- Overrides:
addMessageFirstin classAbstractPendingMessageCursor- Throws:
Exception
-
remove
public final void remove()
Description copied from interface:PendingMessageCursorremove the message at the cursor position- Specified by:
removein interfacePendingMessageCursor- Overrides:
removein classAbstractPendingMessageCursor
-
remove
public final void remove(MessageReference node)
Description copied from interface:PendingMessageCursorremove a node- Specified by:
removein interfacePendingMessageCursor- Overrides:
removein classAbstractPendingMessageCursor
-
clear
public final void clear()
Description copied from interface:PendingMessageCursorclear all pending messages- Specified by:
clearin interfacePendingMessageCursor- Overrides:
clearin classAbstractPendingMessageCursor
-
gc
public void gc()
Description copied from interface:PendingMessageCursorfree up any internal buffers- Specified by:
gcin interfacePendingMessageCursor- Overrides:
gcin classAbstractPendingMessageCursor
-
fillBatch
protected final void fillBatch()
- Overrides:
fillBatchin classAbstractPendingMessageCursor
-
isEmpty
public final boolean isEmpty()
- Specified by:
isEmptyin interfacePendingMessageCursor- Overrides:
isEmptyin classAbstractPendingMessageCursor- Returns:
- true if there are no pending messages
-
hasMessagesBufferedToDeliver
public final boolean hasMessagesBufferedToDeliver()
- Specified by:
hasMessagesBufferedToDeliverin interfacePendingMessageCursor- Overrides:
hasMessagesBufferedToDeliverin classAbstractPendingMessageCursor- Returns:
- true if the cursor has buffered messages ready to deliver
-
size
public final int size()
- Specified by:
sizein interfacePendingMessageCursor- Overrides:
sizein classAbstractPendingMessageCursor- Returns:
- the number of pending messages
-
messageSize
public final long messageSize()
- Specified by:
messageSizein interfacePendingMessageCursor
-
resetBatch
protected abstract void resetBatch()
-
getStoreSize
protected abstract int getStoreSize()
-
getStoreMessageSize
protected abstract long getStoreMessageSize()
-
isStoreEmpty
protected abstract boolean isStoreEmpty()
-
getSubscription
public Subscription getSubscription()
-
-