private synchronized List<MessageReference> expireOldMessages() { List<MessageReference> expired = new ArrayList<MessageReference>(); if (!memoryList.isEmpty()) { for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();) { MessageReference node = iterator.next(); if (node.isExpired()) { node.decrementReferenceCount(); expired.add(node); iterator.remove(); } } } return expired; }
private void discardExpiredMessage(MessageReference reference) { LOG.debug("Discarding expired message {}", reference); if (reference.isExpired() && broker.isExpired(reference)) { ConnectionContext context = new ConnectionContext(); context.setBroker(broker); ((Destination)reference.getRegionDestination()).messageExpired(context, null, new IndirectMessageReference(reference.getMessage())); } }
@Override public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference, Subscription subscription, Throwable poisonCause) { if (messageReference.isExpired() || (poisonCause != null && poisonCause.getMessage() != null && poisonCause.getMessage().contains(DUPLICATE_FROM_STORE_MSG_PREFIX))) {
private void dispatchMatched() throws IOException { synchronized (matchedListMutex) { if (!matched.isEmpty() && !isFull()) { try { matched.reset(); while (matched.hasNext() && !isFull()) { MessageReference message = matched.next(); message.decrementReferenceCount(); matched.remove(); // Message may have been sitting in the matched list a while // waiting for the consumer to ak the message. if (message.isExpired()) { discard(message); continue; // just drop it. } dispatch(message); } } finally { matched.release(); } } } }
if (!node.isExpired()) { try { regionDestination = (Destination) node.getMessage().getRegionDestination();
/** * Discard any expired messages from the matched list. Called from a * synchronized block. * * @throws IOException */ protected void removeExpiredMessages() throws IOException { try { matched.reset(); while (matched.hasNext()) { MessageReference node = matched.next(); node.decrementReferenceCount(); if (node.isExpired()) { matched.remove(); node.decrementReferenceCount(); if (broker.isExpired(node)) { ((Destination) node.getRegionDestination()).getDestinationStatistics().getExpired().increment(); broker.messageExpired(getContext(), node, this); } break; } } } finally { matched.release(); } }
if (!node.isExpired()) { try { regionDestination = (Destination) node.getMessage().getRegionDestination();
if (node != QueueMessageReference.NULL_MESSAGE && node.isExpired()) {
protected synchronized void expireOldMessages() { if (!memoryList.isEmpty()) { LinkedList<MessageReference> tmpList = new LinkedList<MessageReference>(this.memoryList); this.memoryList = new LinkedList<MessageReference>(); while (!tmpList.isEmpty()) { MessageReference node = tmpList.removeFirst(); if (node.isExpired()) { discard(node); } else { memoryList.add(node); } } } }
private synchronized List<MessageReference> expireOldMessages() { List<MessageReference> expired = new ArrayList<MessageReference>(); if (!memoryList.isEmpty()) { for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();) { MessageReference node = iterator.next(); if (node.isExpired()) { node.decrementReferenceCount(); expired.add(node); iterator.remove(); } } } return expired; }
private synchronized List<MessageReference> expireOldMessages() { List<MessageReference> expired = new ArrayList<MessageReference>(); if (!memoryList.isEmpty()) { for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();) { MessageReference node = iterator.next(); if (node.isExpired()) { node.decrementReferenceCount(); expired.add(node); iterator.remove(); } } } return expired; }
private synchronized List<MessageReference> expireOldMessages() { List<MessageReference> expired = new ArrayList<MessageReference>(); if (!memoryList.isEmpty()) { for (Iterator<MessageReference> iterator = memoryList.iterator(); iterator.hasNext();) { MessageReference node = iterator.next(); if (node.isExpired()) { node.decrementReferenceCount(); expired.add(node); iterator.remove(); } } } return expired; }
@Override public boolean isExpired(MessageReference messageReference) { boolean expired = false; if (messageReference.isExpired()) { try { // prevent duplicate expiry processing Message message = messageReference.getMessage(); synchronized (message) { expired = stampAsExpired(message); } } catch (IOException e) { LOG.warn("unexpected exception on message expiry determination for: " + messageReference, e); } } return expired; }
/** * In the queue case, mark the node as dropped and then a gc cycle will * remove it from the queue. * * @throws IOException */ protected void acknowledge(final ConnectionContext context, final MessageAck ack, final MessageReference n) throws IOException { final Destination q = n.getRegionDestination(); final QueueMessageReference node = (QueueMessageReference)n; final Queue queue = (Queue)q; if (n.isExpired()) { // sync with message expiry processing if (!broker.isExpired(n)) { LOG.warn("ignoring ack " + ack + ", for already expired message: " + n); return; } } queue.removeMessage(context, this, node, ack); }
private void discardExpiredMessage(MessageReference reference) { LOG.debug("Discarding expired message {}", reference); if (reference.isExpired() && broker.isExpired(reference)) { ConnectionContext context = new ConnectionContext(); context.setBroker(broker); ((Destination)reference.getRegionDestination()).messageExpired(context, null, new IndirectMessageReference(reference.getMessage())); } }
private void discardExpiredMessage(MessageReference reference) { LOG.debug("Discarding expired message {}", reference); if (reference.isExpired() && broker.isExpired(reference)) { ConnectionContext context = new ConnectionContext(); context.setBroker(broker); ((Destination)reference.getRegionDestination()).messageExpired(context, null, new IndirectMessageReference(reference.getMessage())); } }
private void discardExpiredMessage(MessageReference reference) { LOG.debug("Discarding expired message {}", reference); if (reference.isExpired() && broker.isExpired(reference)) { ConnectionContext context = new ConnectionContext(); context.setBroker(broker); ((Destination)reference.getRegionDestination()).messageExpired(context, null, new IndirectMessageReference(reference.getMessage())); } }
private void dispatchMatched() throws IOException { synchronized (matchedListMutex) { if (!matched.isEmpty() && !isFull()) { try { matched.reset(); while (matched.hasNext() && !isFull()) { MessageReference message = matched.next(); message.decrementReferenceCount(); matched.remove(); // Message may have been sitting in the matched list a while // waiting for the consumer to ak the message. if (message.isExpired()) { discard(message); continue; // just drop it. } dispatch(message); } } finally { matched.release(); } } } }
private void dispatchMatched() throws IOException { synchronized (matchedListMutex) { if (!matched.isEmpty() && !isFull()) { try { matched.reset(); while (matched.hasNext() && !isFull()) { MessageReference message = matched.next(); message.decrementReferenceCount(); matched.remove(); // Message may have been sitting in the matched list a while // waiting for the consumer to ak the message. if (message.isExpired()) { discard(message); continue; // just drop it. } dispatch(message); } } finally { matched.release(); } } } }
/** * Discard any expired messages from the matched list. Called from a * synchronized block. * * @throws IOException */ protected void removeExpiredMessages() throws IOException { try { matched.reset(); while (matched.hasNext()) { MessageReference node = matched.next(); node.decrementReferenceCount(); if (node.isExpired()) { matched.remove(); node.decrementReferenceCount(); if (broker.isExpired(node)) { ((Destination) node.getRegionDestination()).getDestinationStatistics().getExpired().increment(); broker.messageExpired(getContext(), node, this); } break; } } } finally { matched.release(); } }