public static MessageReference createReference(Message encode, final Queue queue) { return new MessageReferenceImpl(encode, queue); } }
@Override public void acknowledge(Transaction tx) throws Exception { acknowledge(tx, null); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other instanceof MessageReferenceImpl) { MessageReferenceImpl reference = (MessageReferenceImpl) other; if (this.getMessage().equals(reference.getMessage())) return true; } return false; }
private void addMessage(ScheduledDeliveryHandlerImpl handler, long nextMessageID, long nextScheduledTime, boolean tail) { MessageReferenceImpl refImpl = new MessageReferenceImpl(new FakeMessage(nextMessageID), null); refImpl.setScheduledDeliveryTime(nextScheduledTime); handler.addInPlace(nextScheduledTime, refImpl, tail); }
@Override public void nonDurableUp(Message message, int count) { if (count == 1) { this.addSize(message.getMemoryEstimate() + MessageReferenceImpl.getMemoryEstimate()); } else { this.addSize(MessageReferenceImpl.getMemoryEstimate()); } }
public MessageReferenceImpl(final MessageReferenceImpl other, final Queue queue) { DELIVERY_COUNT_UPDATER.set(this, other.getDeliveryCount()); scheduledDeliveryTime = other.scheduledDeliveryTime; message = other.message; this.queue = queue; }
private void checkAndSchedule(ScheduledDeliveryHandlerImpl handler, long nextMessageID, long nextScheduledTime, boolean tail, Queue queue) { MessageReferenceImpl refImpl = new MessageReferenceImpl(new FakeMessage(nextMessageID), queue); refImpl.setScheduledDeliveryTime(nextScheduledTime); handler.checkAndSchedule(refImpl, tail); }
@Override public void nonDurableDown(Message message, int count) { if (count < 0) { // this could happen on paged messages since they are not routed and incrementRefCount is never called return; } if (count == 0) { this.addSize(-message.getMemoryEstimate() - MessageReferenceImpl.getMemoryEstimate()); } else { this.addSize(-MessageReferenceImpl.getMemoryEstimate()); } }
@Override public MessageReference copy(final Queue queue) { return new MessageReferenceImpl(this, queue); }
@Override public int hashCode() { return this.getMessage().hashCode(); }
@Override public void acknowledge(Transaction tx, ServerConsumer consumer) throws Exception { acknowledge(tx, AckReason.NORMAL, consumer); }
@Override public Object createObject() { return new MessageReferenceImpl(); } }));
@Override public String toString() { return "Reference[" + getMessage().getMessageID() + "]:" + (getMessage().isDurable() ? "RELIABLE" : "NON-RELIABLE") + ":" + getMessage(); }
@Override public void acknowledge() throws Exception { this.acknowledge(null); }
@Override public MessageReference reroute(final Message message, final Queue queue, final Transaction tx) throws Exception { message.incrementRefCount(); return new MessageReferenceImpl(); }
@Override public long getPersistentSize() throws ActiveMQException { return this.getMessage().getPersistentSize(); } }
@Override public long getMessageID() { return getMessage().getMessageID(); }
@Override public boolean isDurable() { return getMessage().isDurable(); }