Package com.swiftmq.swiftlet.queue
Class AbstractQueue
- java.lang.Object
-
- com.swiftmq.swiftlet.queue.AbstractQueue
-
public abstract class AbstractQueue extends java.lang.ObjectAbstract base class for queues used in SwiftMQ. All operations on the queue will be controlled by the queue manager. Access to queues are exclusively performed by the resp. accessor classes like QueuePull/PushTransaction.- Author:
- IIT GmbH, Bremen/Germany, Copyright (c) 2000-2002, All Rights Reserved
-
-
Field Summary
Fields Modifier and Type Field Description static intACTIVESTANDBYstatic intAS_MESSAGEprotected longcleanUpIntervalprotected intconsumerModestatic intEXCLUSIVEprotected FlowControllerflowControllerprotected intmaxMessagesstatic intNON_PERSISTENTprotected intpersistenceModestatic intPERSISTENTprotected intreceiverCountstatic intSHAREDprotected booleantemporary
-
Constructor Summary
Constructors Constructor Description AbstractQueue()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidacknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex)Acknowledges a message that was fetched within a pull transaction.voidacknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex, AsyncCompletionCallback callback)Async acknowledges a message that was fetched within a pull transaction.voidacknowledgeMessages(java.lang.Object transactionId, java.util.List messageIndexList, AsyncCompletionCallback callback)Async acknowledges a list of messages that were fetched within a pull transaction.voidaddWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)java.lang.ObjectbuildPreparedTransaction(PrepareLogRecord logRecord)Builds a new QueueTransaction on base of the PrepareLogRecord.voidcleanUpExpiredMessages()Deletes all expired messages from the queueabstract voidcommit(java.lang.Object transactionId)Commit the transaction with the given transaction idabstract voidcommit(java.lang.Object localtransactionId, XidImpl globalTransactionId)Commits a prepared transaction.abstract voidcommit(java.lang.Object transactionId, AsyncCompletionCallback callback)Asynchronously commits the transaction with the given transaction idabstract java.lang.ObjectcreatePullTransaction()Creates a new pull transaction and returns a unique transaction idabstract java.lang.ObjectcreatePushTransaction()Creates a new push transaction and returns a unique transaction idintcreateView(Selector selector)Creates a new view, based on a selectorvoiddecReceiverCount()Decrements the queue receiver count.voiddeleteContent()Removes all messages from the queue.voiddeleteView(int viewId)Creates a new view, based on a selectorvoidflushAccounting()intgetCacheSize()Returns the max.intgetCacheSizeKB()Returns the max cache size in KBlonggetCleanUpInterval()Returns the cleanup interval in millisecondsCompositeStoreTransactiongetCompositeStoreTransaction(java.lang.Object txId)Returns the current composite store transactionintgetConsumedTotal()Returns the total number of consumed messagesintgetConsumerMode()intgetConsumingRate()Returns the consuming rate in Msgs/SecintgetCurrentCacheSizeKB()Returns the current cache size in KBintgetCurrentCacheSizeMessages()Returns the current cache size in number messages.MessageEntrygetExpiredMessage(java.lang.Object transactionId, long timeout)Get the next expired message from the queue but wait only a specific period of time.FlowControllergetFlowController()Returns the flow controller.MessageIndexgetIndexEntry(MessageIndex messageIndex)Returns the actual index entry (the implementation of the MessageIndex class) used for this MessageIndexjava.lang.StringgetLocalName()Returns the local name.intgetMaxMessages()Returns the max.MessageEntrygetMessage(java.lang.Object transactionId)Get a message from the queue.MessageEntrygetMessage(java.lang.Object transactionId, long timeout)Get a message from the queue but wait only a specific period of time.MessageEntrygetMessage(java.lang.Object transactionId, Selector selector)Get a message from the queue that matches the selector.MessageEntrygetMessage(java.lang.Object transactionId, Selector selector, int viewId)Get the next message from a view.MessageEntrygetMessage(java.lang.Object transactionId, Selector selector, int viewId, long timeout)Get the next message from the view but wait only a specific period of time.MessageEntrygetMessage(java.lang.Object transactionId, Selector selector, long timeout)Get a message from the queue that matches the selector but wait only a specific period of time.MessageEntrygetMessageByIndex(MessageIndex messageIndex)Returns the message with that given key.intgetMonitorAlertThreshold()longgetNumberQueueMessages()Returns the number of messages actually stored in the queueintgetPersistenceMode()Returns the queue persistence mode.intgetProducedTotal()Returns the total number of produced messagesintgetProducingRate()Returns the producing rate in Msgs/Secjava.util.SortedSetgetQueueIndex()Returns a current snapshot of the queue index (message indexes)java.util.SortedSetgetQueueIndex(int viewId)Returns a current snapshot of the viewjava.lang.StringgetQueueName()Returns the queue nameQueueReceiverListenergetQueueReceiverListener()intgetReceiverCount()Returns the queue receiver count.abstract booleanhasReceiver(MessageImpl message)Checks all registered receivers and, if set, their message selectors whether this message will be received by one of them.voidincReceiverCount()Increments the queue receiver count.booleanisAccounting()booleanisRunning()Returns if the queue is running or notbooleanisTemporary()Returns the temporary flag.voidlockQueue(java.lang.Object txId)Locks this queue and holds it until unlockQueue is called.voidmoveToTransaction(MessageIndex messageIndex, java.lang.Object destTxId)Moves a message with the given message index to the destination transaction.voidmoveToTransaction(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId)Moves a message with the given message index from the source to the destination transaction.longmoveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object destTxId)Moves a message with the given message index to the destination transaction and returns the message size.longmoveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId)Moves a message with the given message index from the source to the destination transaction and returns its size.abstract voidprepare(java.lang.Object localtransactionId, XidImpl globalTransactionId)Prepares the transaction with the given transaction id.abstract voidputMessage(java.lang.Object transactionId, MessageImpl message)Put a message into the queuevoidreceiverClosed(long receiverId)Internal usevoidregisterMessageProcessor(MessageProcessor messageProcessor)Registers a message processor.voidremoveMessageByIndex(MessageIndex messageIndex)Removes a message with that given key outside a queue transaction.voidremoveMessages(java.lang.Object transactionId, java.util.List<MessageIndex> messageIndexes)Remove messages from a queuevoidremoveWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)voidresetCounters()Resets all consumed/produced countersabstract voidrollback(java.lang.Object transactionId, boolean setRedelivered)Rolls back the transaction with the given transaction id.abstract voidrollback(java.lang.Object transactionId, boolean setRedelivered, AsyncCompletionCallback callback)Asynchronously rolls back the transaction with the given transaction id.abstract voidrollback(java.lang.Object transactionId, XidImpl globalTransactionId, boolean setRedelivered)Rolls back the transaction with the given transaction id, eventually prepared under a global transaction id.AbstractQueueselectBaseQueue()Selects the underlaying base queue of this queue.voidsetCleanUpInterval(long cleanUpInterval)Sets the cleanup interval.voidsetCompositeStoreTransaction(java.lang.Object txId, CompositeStoreTransaction ct)Sets a CompositeStoreTransaction to be used as the current transaction.voidsetConsumerMode(int consumerMode)voidsetFlowController(FlowController flowController)Sets the flow controller.voidsetLocalName(java.lang.String localName)Sets the local name.voidsetMaxMessages(int maxMessages)Sets the max.voidsetPersistenceMode(int persistenceMode)Sets the queue persistence mode.voidsetQueueName(java.lang.String queueName)Set the queue name.voidsetQueueReceiverListener(QueueReceiverListener queueReceiverListener)voidsetTemporary(boolean b)Sets the temporary flag.voidstartAccounting(java.lang.Object accountingProfile)voidstartQueue()Starts the queue.voidstopAccounting()voidstopQueue()Stops the queue.voidtimeoutMessageProcessor(long registrationTime, int id)Removes a message processor which has been timed out.voidunlockQueue(java.lang.Object txId, boolean markAsyncActive)Unlocks this queue.voidunmarkAsyncActive(java.lang.Object txId)Unblocks this queue from async activevoidunregisterMessageProcessor(MessageProcessor messageProcessor)Unregisters a message processor.
-
-
-
Field Detail
-
SHARED
public static final int SHARED
- See Also:
- Constant Field Values
-
EXCLUSIVE
public static final int EXCLUSIVE
- See Also:
- Constant Field Values
-
ACTIVESTANDBY
public static final int ACTIVESTANDBY
- See Also:
- Constant Field Values
-
AS_MESSAGE
public static final int AS_MESSAGE
- See Also:
- Constant Field Values
-
PERSISTENT
public static final int PERSISTENT
- See Also:
- Constant Field Values
-
NON_PERSISTENT
public static final int NON_PERSISTENT
- See Also:
- Constant Field Values
-
maxMessages
protected volatile int maxMessages
-
persistenceMode
protected volatile int persistenceMode
-
temporary
protected boolean temporary
-
flowController
protected FlowController flowController
-
receiverCount
protected int receiverCount
-
cleanUpInterval
protected long cleanUpInterval
-
consumerMode
protected int consumerMode
-
-
Method Detail
-
getQueueName
public java.lang.String getQueueName()
Returns the queue name- Returns:
- queue name
-
setQueueName
public void setQueueName(java.lang.String queueName)
Set the queue name. Will be called from queue manager- Parameters:
queueName- queue name
-
getLocalName
public java.lang.String getLocalName()
Returns the local name.- Returns:
- local name.
-
setLocalName
public void setLocalName(java.lang.String localName)
Sets the local name.- Parameters:
localName- local name.
-
getCacheSize
public int getCacheSize()
Returns the max. cache size in number messages.- Returns:
- cache size.
-
getCacheSizeKB
public int getCacheSizeKB()
Returns the max cache size in KB- Returns:
- cache size.
-
getCurrentCacheSizeMessages
public int getCurrentCacheSizeMessages()
Returns the current cache size in number messages.- Returns:
- cache size.
-
getCurrentCacheSizeKB
public int getCurrentCacheSizeKB()
Returns the current cache size in KB- Returns:
- cache size.
-
isAccounting
public boolean isAccounting()
-
getConsumerMode
public int getConsumerMode()
-
setConsumerMode
public void setConsumerMode(int consumerMode)
-
startAccounting
public void startAccounting(java.lang.Object accountingProfile)
-
flushAccounting
public void flushAccounting()
-
stopAccounting
public void stopAccounting()
-
addWireTapSubscriber
public void addWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)
-
removeWireTapSubscriber
public void removeWireTapSubscriber(java.lang.String name, WireTapSubscriber subscriber)
-
getQueueReceiverListener
public QueueReceiverListener getQueueReceiverListener()
-
setQueueReceiverListener
public void setQueueReceiverListener(QueueReceiverListener queueReceiverListener)
-
getFlowController
public FlowController getFlowController()
Returns the flow controller.- Returns:
- flow controller.
-
setFlowController
public void setFlowController(FlowController flowController)
Sets the flow controller.- Parameters:
flowController- flow controller.
-
incReceiverCount
public void incReceiverCount()
Increments the queue receiver count.
-
decReceiverCount
public void decReceiverCount()
Decrements the queue receiver count.
-
getReceiverCount
public int getReceiverCount()
Returns the queue receiver count.- Returns:
- queue receiver count
-
receiverClosed
public void receiverClosed(long receiverId)
Internal use- Parameters:
receiverId-
-
getMaxMessages
public int getMaxMessages()
Returns the max. messages.- Returns:
- max messages.
-
setMaxMessages
public void setMaxMessages(int maxMessages)
Sets the max. messages.- Parameters:
maxMessages- max messages.
-
isTemporary
public boolean isTemporary()
Returns the temporary flag.- Returns:
- temporary flag.
-
setTemporary
public void setTemporary(boolean b)
Sets the temporary flag.- Parameters:
b- temporary flag.
-
getPersistenceMode
public int getPersistenceMode()
Returns the queue persistence mode.- Returns:
- queue persistence mode.
-
setPersistenceMode
public void setPersistenceMode(int persistenceMode)
Sets the queue persistence mode.- Parameters:
persistenceMode- persistence mode.
-
startQueue
public void startQueue() throws QueueExceptionStarts the queue.- Throws:
QueueException- on error
-
stopQueue
public void stopQueue() throws QueueExceptionStops the queue.- Throws:
QueueException- on error
-
isRunning
public boolean isRunning()
Returns if the queue is running or not- Returns:
- true/false
-
buildPreparedTransaction
public java.lang.Object buildPreparedTransaction(PrepareLogRecord logRecord) throws QueueException
Builds a new QueueTransaction on base of the PrepareLogRecord.- Returns:
- transaction id
- Throws:
QueueException- on error
-
createView
public int createView(Selector selector)
Creates a new view, based on a selector- Returns:
- view id
-
deleteView
public void deleteView(int viewId)
Creates a new view, based on a selector
-
createPushTransaction
public abstract java.lang.Object createPushTransaction() throws QueueExceptionCreates a new push transaction and returns a unique transaction id- Returns:
- transaction id
- Throws:
QueueException- on error
-
createPullTransaction
public abstract java.lang.Object createPullTransaction() throws QueueExceptionCreates a new pull transaction and returns a unique transaction id- Returns:
- transaction id
- Throws:
QueueException- on error
-
selectBaseQueue
public AbstractQueue selectBaseQueue()
Selects the underlaying base queue of this queue. If there is no base queue, this queue instance will be returned.- Returns:
- base queue
-
prepare
public abstract void prepare(java.lang.Object localtransactionId, XidImpl globalTransactionId) throws QueueExceptionPrepares the transaction with the given transaction id. Messages are stored in the queue (on disk when persistent) but not unlocked. The preparation is logged under the global transaction id.- Parameters:
localtransactionId- local transaction idglobalTransactionId- global transaction id- Throws:
QueueException- on error
-
commit
public abstract void commit(java.lang.Object localtransactionId, XidImpl globalTransactionId) throws QueueExceptionCommits a prepared transaction.- Parameters:
localtransactionId- local transaction idglobalTransactionId- global transaction id- Throws:
QueueException- on error
-
commit
public abstract void commit(java.lang.Object transactionId) throws QueueExceptionCommit the transaction with the given transaction id- Parameters:
transactionId- transaction id- Throws:
QueueException- on error
-
commit
public abstract void commit(java.lang.Object transactionId, AsyncCompletionCallback callback)Asynchronously commits the transaction with the given transaction id- Parameters:
transactionId- transaction idcallback- async completion callback
-
rollback
public abstract void rollback(java.lang.Object transactionId, XidImpl globalTransactionId, boolean setRedelivered) throws QueueExceptionRolls back the transaction with the given transaction id, eventually prepared under a global transaction id. If the flagsetRedeliveredis set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated.- Parameters:
transactionId- transaction idglobalTransactionId- global transaction idsetRedelivered- specifies JMS redelivery setting- Throws:
QueueException- on error
-
rollback
public abstract void rollback(java.lang.Object transactionId, boolean setRedelivered) throws QueueExceptionRolls back the transaction with the given transaction id. If the flagsetRedeliveredis set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated- Parameters:
transactionId- transaction idsetRedelivered- specifies JMS redelivery setting- Throws:
QueueException- on error
-
rollback
public abstract void rollback(java.lang.Object transactionId, boolean setRedelivered, AsyncCompletionCallback callback)Asynchronously rolls back the transaction with the given transaction id. If the flagsetRedeliveredis set then the JMS properties for redelivery and delivery count of messages pulled within this transaction are updated- Parameters:
transactionId- transaction idsetRedelivered- specifies JMS redelivery settingcallback- async completion callback
-
cleanUpExpiredMessages
public void cleanUpExpiredMessages() throws QueueExceptionDeletes all expired messages from the queue- Throws:
QueueException- on error
-
getCleanUpInterval
public long getCleanUpInterval() throws QueueExceptionReturns the cleanup interval in milliseconds- Returns:
- interval
- Throws:
QueueException- on error
-
setCleanUpInterval
public void setCleanUpInterval(long cleanUpInterval)
Sets the cleanup interval.- Parameters:
cleanUpInterval- cleanup interval.
-
getNumberQueueMessages
public long getNumberQueueMessages() throws QueueExceptionReturns the number of messages actually stored in the queue- Returns:
- number of messages
- Throws:
QueueException- on error
-
getConsumingRate
public int getConsumingRate()
Returns the consuming rate in Msgs/Sec- Returns:
- consuming rate
-
getProducingRate
public int getProducingRate()
Returns the producing rate in Msgs/Sec- Returns:
- producing rate
-
getConsumedTotal
public int getConsumedTotal()
Returns the total number of consumed messages- Returns:
- total number of consumed messages
-
getProducedTotal
public int getProducedTotal()
Returns the total number of produced messages- Returns:
- total number of produced messages
-
resetCounters
public void resetCounters()
Resets all consumed/produced counters
-
getMonitorAlertThreshold
public int getMonitorAlertThreshold()
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId) throws QueueException
Get a message from the queue. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available.- Parameters:
transactionId-- Returns:
- The message
- Throws:
QueueException- on error
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector) throws QueueException
Get a message from the queue that matches the selector. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available.- Parameters:
transactionId- a valid pull transaction idselector- A message selector- Returns:
- The message
- Throws:
QueueException- on error
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector, int viewId) throws QueueException
Get the next message from a view. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available.- Parameters:
transactionId- a valid pull transaction idselector- a message selectorviewId- view id- Returns:
- The message
- Throws:
QueueException- on error
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, long timeout) throws QueueException, QueueTimeoutException
Get a message from the queue but wait only a specific period of time. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId- a valid pull transaction idtimeout- a timeout in ms- Returns:
- The message
- Throws:
QueueException- on errorQueueTimeoutException- if a timeout occurs
-
getExpiredMessage
public MessageEntry getExpiredMessage(java.lang.Object transactionId, long timeout) throws QueueException, QueueTimeoutException
Get the next expired message from the queue but wait only a specific period of time. The method returns the next available expired message dependend on priority and message time stamp. If no expired message is available then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId- a valid pull transaction idtimeout- a timeout in ms- Returns:
- The message
- Throws:
QueueException- on errorQueueTimeoutException- if a timeout occurs
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector, long timeout) throws QueueException, QueueTimeoutException
Get a message from the queue that matches the selector but wait only a specific period of time. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId- a valid pull transaction idselector- a message selectortimeout- a timeout in ms- Returns:
- The message
- Throws:
QueueException- on errorQueueTimeoutException- if a timeout occurs
-
getMessage
public MessageEntry getMessage(java.lang.Object transactionId, Selector selector, int viewId, long timeout) throws QueueException, QueueTimeoutException
Get the next message from the view but wait only a specific period of time. The method returns the next available message dependend on priority and message time stamp. If no message is available (queue empty) then this method blocks until a message becomes available or a timeout occurs.- Parameters:
transactionId- a valid pull transaction idselector- a message selectorviewId- view Idtimeout- a timeout in ms- Returns:
- The message
- Throws:
QueueException- on errorQueueTimeoutException- if a timeout occurs
-
registerMessageProcessor
public void registerMessageProcessor(MessageProcessor messageProcessor)
Registers a message processor. The message processor will be called asynchrounsly when a message is available.- Parameters:
messageProcessor- message processor.
-
unregisterMessageProcessor
public void unregisterMessageProcessor(MessageProcessor messageProcessor)
Unregisters a message processor.- Parameters:
messageProcessor- message processor.
-
timeoutMessageProcessor
public void timeoutMessageProcessor(long registrationTime, int id)Removes a message processor which has been timed out.- Parameters:
registrationTime- registration time.id- id of the message processor.
-
acknowledgeMessage
public void acknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex, AsyncCompletionCallback callback)Async acknowledges a message that was fetched within a pull transaction. The size of the message will be returned as a result of the callback. This is another way to commit a pull transaction because it commits a single message of the transaction. All other messages of the transaction remain locked.- Parameters:
transactionId- a valid pull transaction idmessageIndex- a valid message indexcallback- async completion callback
-
acknowledgeMessages
public void acknowledgeMessages(java.lang.Object transactionId, java.util.List messageIndexList, AsyncCompletionCallback callback)Async acknowledges a list of messages that were fetched within a pull transaction. The size of the messages will be returned as a result of the callback.- Parameters:
transactionId- a valid pull transaction idmessageIndexList- a list of valid message indexescallback- async completion callback
-
acknowledgeMessage
public void acknowledgeMessage(java.lang.Object transactionId, MessageIndex messageIndex) throws QueueExceptionAcknowledges a message that was fetched within a pull transaction. This is another way to commit a pull transaction because it commits a single message of the transaction. All other messages of the transaction remain locked.- Parameters:
transactionId- a valid pull transaction idmessageIndex- a valid message index- Throws:
QueueException- on error
-
moveToTransactionReturnSize
public long moveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index from the source to the destination transaction and returns its size.- Parameters:
messageIndex- message index.sourceTxId- source transaction id.destTxId- destination transaction id.- Returns:
- size of the corresponding message in bytes
- Throws:
QueueException- on error.
-
moveToTransaction
public void moveToTransaction(MessageIndex messageIndex, java.lang.Object sourceTxId, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index from the source to the destination transaction.- Parameters:
messageIndex- message index.sourceTxId- source transaction id.destTxId- destination transaction id.- Throws:
QueueException- on error.
-
moveToTransactionReturnSize
public long moveToTransactionReturnSize(MessageIndex messageIndex, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index to the destination transaction and returns the message size. The source transaction is determined by the message index.- Parameters:
messageIndex- message index.destTxId- destination transaction id.- Returns:
- size of the corresponding message in bytes
- Throws:
QueueException- on error.
-
moveToTransaction
public void moveToTransaction(MessageIndex messageIndex, java.lang.Object destTxId) throws QueueException
Moves a message with the given message index to the destination transaction. The source transaction is determined by the message index.- Parameters:
messageIndex- message index.destTxId- destination transaction id.- Throws:
QueueException- on error.
-
hasReceiver
public abstract boolean hasReceiver(MessageImpl message)
Checks all registered receivers and, if set, their message selectors whether this message will be received by one of them.- Parameters:
message-- Returns:
- has receiver or not
-
putMessage
public abstract void putMessage(java.lang.Object transactionId, MessageImpl message) throws QueueExceptionPut a message into the queue- Parameters:
transactionId- a valid push transaction idmessage- the message- Throws:
QueueException- on error
-
removeMessages
public void removeMessages(java.lang.Object transactionId, java.util.List<MessageIndex> messageIndexes) throws QueueExceptionRemove messages from a queue- Parameters:
transactionId- a valid push transaction idmessageIndexes- List of MessageIndexes to remove- Throws:
QueueException- on error
-
getQueueIndex
public java.util.SortedSet getQueueIndex() throws QueueExceptionReturns a current snapshot of the queue index (message indexes)- Returns:
- queue index
- Throws:
QueueException- on error
-
getQueueIndex
public java.util.SortedSet getQueueIndex(int viewId) throws QueueExceptionReturns a current snapshot of the view- Parameters:
viewId- the view id- Returns:
- queue index
- Throws:
QueueException- on error
-
getMessageByIndex
public MessageEntry getMessageByIndex(MessageIndex messageIndex) throws QueueException
Returns the message with that given key. If the message is not available anymore, the method returns null.- Parameters:
messageIndex- message index- Returns:
- message entry
- Throws:
QueueException- on error
-
removeMessageByIndex
public void removeMessageByIndex(MessageIndex messageIndex) throws QueueException
Removes a message with that given key outside a queue transaction.- Parameters:
messageIndex-- Throws:
QueueException- if the message is locked by another consumer
-
getIndexEntry
public MessageIndex getIndexEntry(MessageIndex messageIndex) throws QueueException
Returns the actual index entry (the implementation of the MessageIndex class) used for this MessageIndex- Parameters:
messageIndex-- Returns:
- index entry
- Throws:
QueueException- on error
-
deleteContent
public void deleteContent() throws QueueExceptionRemoves all messages from the queue.- Throws:
QueueException- on error
-
lockQueue
public void lockQueue(java.lang.Object txId)
Locks this queue and holds it until unlockQueue is called.- Parameters:
txId- local transactionId
-
unlockQueue
public void unlockQueue(java.lang.Object txId, boolean markAsyncActive)Unlocks this queue.- Parameters:
txId- local transactionIdmarkAsyncActive- blocks queue as async is active
-
unmarkAsyncActive
public void unmarkAsyncActive(java.lang.Object txId)
Unblocks this queue from async active- Parameters:
txId- local transactionId
-
setCompositeStoreTransaction
public void setCompositeStoreTransaction(java.lang.Object txId, CompositeStoreTransaction ct)Sets a CompositeStoreTransaction to be used as the current transaction. At the same time it disables prepare/commit/rollback calls inside this queue so that multiple queues can use the same transaction and prepare/commit/rollback is done outside.- Parameters:
txId- local transactionIdct- composite transaction
-
getCompositeStoreTransaction
public CompositeStoreTransaction getCompositeStoreTransaction(java.lang.Object txId)
Returns the current composite store transaction- Parameters:
txId- local transactionId- Returns:
- composite transaction
-
-