Class PagedReferenceImpl
- java.lang.Object
-
- org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node<PagedReferenceImpl>
-
- org.apache.activemq.artemis.core.paging.cursor.PagedReferenceImpl
-
- All Implemented Interfaces:
Runnable,PagedReference,MessageReference
- Direct Known Subclasses:
QueryPagedReferenceImpl
public class PagedReferenceImpl extends LinkedListImpl.Node<PagedReferenceImpl> implements PagedReference, Runnable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.server.MessageReference
MessageReference.Factory
-
-
Field Summary
Fields Modifier and Type Field Description protected PagedMessagemessageprotected PageSubscriptionsubscription
-
Constructor Summary
Constructors Constructor Description PagedReferenceImpl(PagedMessage message, PageSubscription subscription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledge()voidacknowledge(Transaction tx)voidacknowledge(Transaction tx, AckReason reason, ServerConsumer consumer)voidacknowledge(Transaction tx, ServerConsumer consumer)voidaddPendingFlag()MessageReferencecopy(Queue queue)voiddecrementDeliveryCount()voidemptyConsumerID()longgetConsumerId()intgetDeliveryCount()SimpleStringgetLastValueProperty()MessagegetMessage()longgetMessageID()intgetMessageMemoryEstimate()We define this method aggregation here because on paging we need to hold the original estimate, so we need to perform some extra steps on paging.PagedMessagegetPagedMessage()intgetPersistedCount()longgetPersistentSize()This is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking for the amount of data on a queuePagePositiongetPosition()This will create a new PagePosition, or return one previously created.ObjectgetProtocolData()To be used on holding protocol specific data during the delivery.QueuegetQueue()longgetScheduledDeliveryTime()longgetTransactionID()voidhandled()booleanhasConsumerId()voidincrementDeliveryCount()booleanisAlreadyAcked()booleanisDurable()booleanisInDelivery()booleanisLargeMessage()booleanisPaged()voidonDelivery(Consumer<? super MessageReference> onDelivery)This is to be used in cases where a message delivery happens on an executor.voidremovePendingFlag()voidrun()It will callConsumer.accept(Object)onthisof theConsumerregistered inonDelivery(Consumer), if any.voidsetAlreadyAcked()voidsetConsumerId(long consumerID)voidsetDeliveryCount(int deliveryCount)voidsetInDelivery(boolean inDelivery)voidsetPersistedCount(int count)voidsetProtocolData(Object protocolData)To be used on holding protocol specific data during the delivery.voidsetScheduledDeliveryTime(long scheduledDeliveryTime)StringtoString()-
Methods inherited from class org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node
next, prev, val
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.MessageReference
skipDelivery
-
-
-
-
Field Detail
-
message
protected PagedMessage message
-
subscription
protected final PageSubscription subscription
-
-
Constructor Detail
-
PagedReferenceImpl
public PagedReferenceImpl(PagedMessage message, PageSubscription subscription)
-
-
Method Detail
-
getPosition
public PagePosition getPosition()
This will create a new PagePosition, or return one previously created. This method is used to avoid repetitions on browsing iteration only.- Specified by:
getPositionin interfacePagedReference
-
getProtocolData
public Object getProtocolData()
Description copied from interface:MessageReferenceTo be used on holding protocol specific data during the delivery. This will be only valid while the message is on the delivering queue at the consumer- Specified by:
getProtocolDatain interfaceMessageReference
-
setProtocolData
public void setProtocolData(Object protocolData)
Description copied from interface:MessageReferenceTo be used on holding protocol specific data during the delivery. This will be only valid while the message is on the delivering queue at the consumer- Specified by:
setProtocolDatain interfaceMessageReference
-
getMessage
public Message getMessage()
- Specified by:
getMessagein interfaceMessageReference
-
onDelivery
public void onDelivery(Consumer<? super MessageReference> onDelivery)
Description copied from interface:MessageReferenceThis is to be used in cases where a message delivery happens on an executor. Most MessageReference implementations will allow execution, and if it does, and the protocol requires an execution per message, this callback may be used. At the time of this implementation only AMQP was used.- Specified by:
onDeliveryin interfaceMessageReference
-
run
public void run()
It will callConsumer.accept(Object)onthisof theConsumerregistered inonDelivery(Consumer), if any.
-
getPagedMessage
public PagedMessage getPagedMessage()
- Specified by:
getPagedMessagein interfacePagedReference
-
isPaged
public boolean isPaged()
- Specified by:
isPagedin interfaceMessageReference
-
setPersistedCount
public void setPersistedCount(int count)
- Specified by:
setPersistedCountin interfaceMessageReference
-
getPersistedCount
public int getPersistedCount()
- Specified by:
getPersistedCountin interfaceMessageReference
-
getMessageMemoryEstimate
public int getMessageMemoryEstimate()
Description copied from interface:MessageReferenceWe define this method aggregation here because on paging we need to hold the original estimate, so we need to perform some extra steps on paging.- Specified by:
getMessageMemoryEstimatein interfaceMessageReference- Returns:
-
copy
public MessageReference copy(Queue queue)
- Specified by:
copyin interfaceMessageReference
-
getScheduledDeliveryTime
public long getScheduledDeliveryTime()
- Specified by:
getScheduledDeliveryTimein interfaceMessageReference- Returns:
- The time in the future that delivery will be delayed until, or zero if no scheduled delivery will occur
-
setScheduledDeliveryTime
public void setScheduledDeliveryTime(long scheduledDeliveryTime)
- Specified by:
setScheduledDeliveryTimein interfaceMessageReference
-
getDeliveryCount
public int getDeliveryCount()
- Specified by:
getDeliveryCountin interfaceMessageReference
-
setDeliveryCount
public void setDeliveryCount(int deliveryCount)
- Specified by:
setDeliveryCountin interfaceMessageReference
-
incrementDeliveryCount
public void incrementDeliveryCount()
- Specified by:
incrementDeliveryCountin interfaceMessageReference
-
decrementDeliveryCount
public void decrementDeliveryCount()
- Specified by:
decrementDeliveryCountin interfaceMessageReference
-
getQueue
public Queue getQueue()
- Specified by:
getQueuein interfaceMessageReference
-
handled
public void handled()
- Specified by:
handledin interfaceMessageReference
-
setInDelivery
public void setInDelivery(boolean inDelivery)
- Specified by:
setInDeliveryin interfaceMessageReference
-
isInDelivery
public boolean isInDelivery()
- Specified by:
isInDeliveryin interfaceMessageReference
-
setAlreadyAcked
public void setAlreadyAcked()
- Specified by:
setAlreadyAckedin interfaceMessageReference
-
isAlreadyAcked
public boolean isAlreadyAcked()
- Specified by:
isAlreadyAckedin interfaceMessageReference
-
acknowledge
public void acknowledge() throws Exception- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx) throws Exception
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx, ServerConsumer consumer) throws Exception
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx, AckReason reason, ServerConsumer consumer) throws Exception
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
toString
public String toString()
- Overrides:
toStringin classLinkedListImpl.Node<PagedReferenceImpl>
-
emptyConsumerID
public void emptyConsumerID()
- Specified by:
emptyConsumerIDin interfaceMessageReference
-
setConsumerId
public void setConsumerId(long consumerID)
- Specified by:
setConsumerIdin interfaceMessageReference
-
hasConsumerId
public boolean hasConsumerId()
- Specified by:
hasConsumerIdin interfaceMessageReference
-
getConsumerId
public long getConsumerId()
- Specified by:
getConsumerIdin interfaceMessageReference
-
isLargeMessage
public boolean isLargeMessage()
- Specified by:
isLargeMessagein interfacePagedReference
-
getTransactionID
public long getTransactionID()
- Specified by:
getTransactionIDin interfacePagedReference
-
addPendingFlag
public void addPendingFlag()
- Specified by:
addPendingFlagin interfacePagedReference
-
removePendingFlag
public void removePendingFlag()
- Specified by:
removePendingFlagin interfacePagedReference
-
getMessageID
public long getMessageID()
- Specified by:
getMessageIDin interfaceMessageReference
-
getLastValueProperty
public SimpleString getLastValueProperty()
- Specified by:
getLastValuePropertyin interfaceMessageReference
-
getPersistentSize
public long getPersistentSize()
Description copied from interface:MessageReferenceThis is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking for the amount of data on a queue- Specified by:
getPersistentSizein interfaceMessageReference- Returns:
-
isDurable
public boolean isDurable()
- Specified by:
isDurablein interfaceMessageReference
-
-