private void handleRegularMessage(ClientMessageInternal message) { if (message.getAddress() == null) { message.setAddress(queueInfo.getAddress()); } message.onReceipt(this); if (!ackIndividually && message.getPriority() != 4 && !message.containsProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE)) { // We have messages of different priorities so we need to ack them individually since the order // of them in the ServerConsumerImpl delivery list might not be the same as the order they are // consumed in, which means that acking all up to won't work ackIndividually = true; } // Add it to the buffer buffer.addTail(message, message.getPriority()); if (handler != null) { // Execute using executor if (!stopped) { queueExecutor(); } } else { notify(); } }
@Override public void clear(boolean waitForOnMessage) throws ActiveMQException { synchronized (this) { // Need to send credits for the messages in the buffer Iterator<ClientMessageInternal> iter = buffer.iterator(); while (iter.hasNext()) { try { ClientMessageInternal message = iter.next(); if (message.isLargeMessage()) { ClientLargeMessageInternal largeMessage = (ClientLargeMessageInternal) message; largeMessage.getLargeMessageController().cancel(); } flowControlBeforeConsumption(message); } catch (Exception e) { ActiveMQClientLogger.LOGGER.errorClearingMessages(e); } } clearBuffer(); try { resetLargeMessageController(); } catch (Throwable e) { // nothing that could be done here ActiveMQClientLogger.LOGGER.errorClearingMessages(e); } } // Need to send credits for the messages in the buffer waitForOnMessageToComplete(waitForOnMessage); }
@Override public int getBufferSize() { return buffer.size(); }
while ((stopped || (m = buffer.poll()) == null) && !closed && toWait > 0) { if (start == -1) { start = System.currentTimeMillis();
private void clearBuffer() { buffer.clear(); }
/** * The caller of this method requires synchronized on the queue. * I'm not going to add synchronized to this method just for a precaution, * as I'm not 100% sure this won't cause any extra runtime. * * @param ref */ private void internalAddHead(final MessageReference ref) { queueMemorySize.addAndGet(ref.getMessageMemoryEstimate()); pendingMetrics.incrementMetrics(ref); refAdded(ref); int priority = getPriority(ref); messageReferences.addHead(ref, priority); }
message = buffer.poll();
private void clearBuffer() { buffer.clear(); }
private void requeueExecutors() { for (int i = 0; i < buffer.size(); i++) { queueExecutor(); } }
@Override public LinkedListIterator<MessageReference> iterator() { return new SynchronizedIterator(messageReferences.iterator()); }
while ((stopped || (m = buffer.poll()) == null) && !closed && toWait > 0) { if (start == -1) { start = System.currentTimeMillis();
private synchronized void internalAddTail(final MessageReference ref) { refAdded(ref); messageReferences.addTail(ref, getPriority(ref)); pendingMetrics.incrementMetrics(ref); }
private void clearBuffer() { buffer.clear(); }
/** * Used on testing only * */ public int getNumberOfReferences() { return messageReferences.size(); }
private QueueBrowserIterator() { messagesIterator = new SynchronizedIterator(messageReferences.iterator()); }
while ((stopped || (m = buffer.poll()) == null) && !closed && toWait > 0) { if (start == -1) { start = System.currentTimeMillis();
private void handleRegularMessage(ClientMessageInternal message) { if (message.getAddress() == null) { message.setAddress(queueInfo.getAddress()); } message.onReceipt(this); if (!ackIndividually && message.getPriority() != 4 && !message.containsProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE)) { // We have messages of different priorities so we need to ack them individually since the order // of them in the ServerConsumerImpl delivery list might not be the same as the order they are // consumed in, which means that acking all up to won't work ackIndividually = true; } // Add it to the buffer buffer.addTail(message, message.getPriority()); if (handler != null) { // Execute using executor if (!stopped) { queueExecutor(); } } else { notify(); } }
private void clearBuffer() { buffer.clear(); }
@Override public int getBufferSize() { return buffer.size(); }