public long getPendingMessageCount() { return this.destinationStatistics.getMessages().getCount(); }
/** * @return the depth of the Destination */ public long getQueueSize() { return destination.getDestinationStatistics().getMessages().getCount(); }
@Override public String toString() { return destination.getQualifiedName() + ", subscriptions=" + consumers.size() + ", memory=" + memoryUsage.getPercentUsage() + "%, size=" + destinationStatistics.getMessages().getCount() + ", pending=" + indexOrderedCursorUpdates.size(); }
@Override public long getQueueSize() { return destination.getDestinationStatistics().getMessages().getCount(); }
public void processExpired() { for (Message message: toExpire) { messageExpired(createConnectionContext(), createMessageReference(message)); // drop message will decrement so counter // balance here destinationStatistics.getMessages().increment(); } toExpire.clear(); }
@Override public void dispose(ConnectionContext context) throws IOException { if (this.destinationStatistics.getMessages().getCount() > 0) { LOG.info("{} on dispose, purge of {} pending messages: {}", new Object[]{ getActiveMQDestination().getQualifiedName(), this.destinationStatistics.getMessages().getCount(), messages }); // we may want to capture these message ids in an advisory } try { purge(); } catch (Exception e) { LOG.warn("Caught an exception purging Queue: {}", destination, e); } super.dispose(context); } }
public boolean checkQueueSize(String queueName) { long count = 0; long queueSize = 0; Map<ActiveMQDestination, Destination> destinationMap = regionBroker.getDestinationMap(); for (Map.Entry<ActiveMQDestination, Destination> entry : destinationMap.entrySet()) { if (entry.getKey().isQueue()) { if (entry.getValue().getName().matches(queueName)) { queueSize = entry.getValue().getDestinationStatistics().getMessages().getCount(); count += queueSize; if (queueSize > 0) { LOG.info("Queue has pending message: {} queueSize is: {}", entry.getValue().getName(), queueSize); } } } } return count == 0; }
@Override public void afterRollback() throws Exception { if (!messageSend) { Destination dest = transactionBroker.addDestination(transactionBroker.context, destination, false); dest.clearPendingMessages(opCount); dest.getDestinationStatistics().getMessages().add(opCount); LOG.debug("cleared pending from afterRollback: {}", destination); } }
@Override public long getTotalMessageCount() { return safeGetBroker().getDestinationStatistics().getMessages().getCount(); }
private void dropMessage(QueueMessageReference reference) { //use dropIfLive so we only process the statistics at most one time if (reference.dropIfLive()) { getDestinationStatistics().getDequeues().increment(); getDestinationStatistics().getMessages().decrement(); pagedInMessagesLock.writeLock().lock(); try { pagedInMessages.remove(reference); } finally { pagedInMessagesLock.writeLock().unlock(); } } }
} while (set.size() < this.destinationStatistics.getMessages().getCount()); return movedCounter;
} while (set.size() < this.destinationStatistics.getMessages().getCount() && set.size() < maximumMessages); return movedCounter;
try { sendLock.lock(); long originalMessageCount = this.destinationStatistics.getMessages().getCount(); do { doPageIn(true, false, getMaxPageSize()); // signal no expiry processing needed. } while (!list.isEmpty() && this.destinationStatistics.getMessages().getCount() > 0); if (this.destinationStatistics.getMessages().getCount() > 0) { LOG.warn("{} after purge of {} messages, message count stats report: {}", getActiveMQDestination().getQualifiedName(), originalMessageCount, this.destinationStatistics.getMessages().getCount());
long numberOfRetryAttemptsToCheckAllMessagesOnce = this.destinationStatistics.getMessages().getCount(); Set<MessageReference> set = new LinkedHashSet<MessageReference>(); do { } while (numberOfRetryAttemptsToCheckAllMessagesOnce > 0 && set.size() < this.destinationStatistics.getMessages().getCount()); return restoredCounter;
public synchronized void purge() throws Exception { final long originalMessageCount = destination.getDestinationStatistics().getMessages().getCount(); ((Queue)destination).purge(); LOG.info("{} purge of {} messages", destination.getActiveMQDestination().getQualifiedName(), originalMessageCount); }
@Override public boolean recoverMessage(Message message) { recoveredAccumulator++; if ((recoveredAccumulator % 10000) == 0) { LOG.info("cursor for {} has recovered {} messages. {}% complete", new Object[]{ getActiveMQDestination().getQualifiedName(), recoveredAccumulator, new Integer((int) (recoveredAccumulator * 100 / totalMessageCount))}); } // Message could have expired while it was being // loaded.. message.setRegionDestination(Queue.this); if (message.isExpired() && broker.isExpired(message)) { toExpire.add(message); return true; } if (hasSpace()) { messagesLock.writeLock().lock(); try { try { messages.addMessageLast(message); } catch (Exception e) { LOG.error("Failed to add message to cursor", e); } } finally { messagesLock.writeLock().unlock(); } destinationStatistics.getMessages().increment(); return true; } return false; }
final void messageSent(final ConnectionContext context, final Message msg) throws Exception { pendingSends.decrementAndGet(); destinationStatistics.getEnqueues().increment(); destinationStatistics.getMessages().increment(); destinationStatistics.getMessageSize().addSize(msg.getSize()); messageDelivered(context, msg); consumersLock.readLock().lock(); try { if (consumers.isEmpty()) { onMessageWithNoConsumers(context, msg); } }finally { consumersLock.readLock().unlock(); } LOG.debug("{} Message {} sent to {}", new Object[]{ broker.getBrokerName(), msg.getMessageId(), this.destination }); wakeup(); }
do { int oldMaxSize = getMaxPageSize(); setMaxPageSize((int) this.destinationStatistics.getMessages().getCount()); doPageIn(true); setMaxPageSize(oldMaxSize); } while (count < this.destinationStatistics.getMessages().getCount()); return movedCounter;
@Override public void afterCommit() throws Exception { Destination dest = transactionBroker.addDestination(transactionBroker.context, destination, false); if (messageSend) { dest.clearPendingMessages(opCount); dest.getDestinationStatistics().getEnqueues().add(opCount); dest.getDestinationStatistics().getMessages().add(opCount); LOG.debug("cleared pending from afterCommit: {}", destination); } else { dest.getDestinationStatistics().getDequeues().add(opCount); } } }
} while (!listener.done()); } else { destinationStatistics.getMessages().add(messageCount);