Class PagedReferenceImpl
java.lang.Object
org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node<MessageReferenceImpl>
org.apache.activemq.artemis.core.server.impl.AbstractProtocolReference
org.apache.activemq.artemis.core.paging.cursor.PagedReferenceImpl
- All Implemented Interfaces:
Runnable,PagedReference,MessageReference
- Direct Known Subclasses:
QueryPagedReferenceImpl
public class PagedReferenceImpl
extends AbstractProtocolReference
implements PagedReference, Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.activemq.artemis.core.server.MessageReference
MessageReference.Factory -
Field Summary
FieldsFields inherited from class org.apache.activemq.artemis.core.server.impl.AbstractProtocolReference
sequence -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidacknowledge(Transaction tx, AckReason reason, ServerConsumer consumer) voidacknowledge(Transaction tx, AckReason reason, ServerConsumer consumer, boolean delivering) voidacknowledge(Transaction tx, ServerConsumer consumer) voidvoidvoidlongintlongintWe 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.intlongThis 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 queueThis will create a new PagePosition, or return one previously created.getQueue()longReturns The time in the future that delivery will be delayed until, or zero if no scheduled delivery will occur.longvoidhandled()booleanvoidbooleanbooleanbooleanbooleanbooleanisPaged()voidonDelivery(Consumer<? super MessageReference> onDelivery) This is to be used in cases where a message delivery happens on an executor.voidvoidrun()It will callConsumer.accept(Object)onthisof theConsumerregistered inonDelivery(Consumer), if any.voidvoidsetConsumerId(long consumerID) voidsetDeliveryCount(int deliveryCount) voidsetInDelivery(boolean inDelivery) voidsetPersistedCount(int count) voidsetScheduledDeliveryTime(long scheduledDeliveryTime) toString()Methods inherited from class org.apache.activemq.artemis.core.server.impl.AbstractProtocolReference
getProtocolData, getSequence, setProtocolData, setSequenceMethods inherited from class org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node
next, prev, valMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.MessageReference
getProtocolData, getSequence, setProtocolData, setSequence, skipDelivery
-
Field Details
-
message
-
subscription
-
-
Constructor Details
-
PagedReferenceImpl
-
-
Method Details
-
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
-
getMessage
- Specified by:
getMessagein interfaceMessageReference
-
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
- 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
-
copy
- Specified by:
copyin interfaceMessageReference
-
getScheduledDeliveryTime
public long getScheduledDeliveryTime()Description copied from interface:MessageReferenceReturns The time in the future that delivery will be delayed until, or zero if no scheduled delivery will occur.- 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
- 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
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
- Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
acknowledge
public void acknowledge(Transaction tx, AckReason reason, ServerConsumer consumer, boolean delivering) throws Exception - Specified by:
acknowledgein interfaceMessageReference- Throws:
Exception
-
toString
- Overrides:
toStringin classLinkedListImpl.Node<MessageReferenceImpl>
-
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
- 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
-
isDurable
public boolean isDurable()- Specified by:
isDurablein interfaceMessageReference
-