public void onCreateDurableSubscriber() { durableSubscriptionCount.increment(); }
@Override public void addSubscription(ConnectionContext context, Subscription sub) throws Exception{ destinationStatistics.getConsumers().increment(); this.lastActiveTime=0l; }
@Override public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception { destinationStatistics.getProducers().increment(); this.lastActiveTime=0l; }
@Override public void incrementConsumedCount(){ subscriptionStatistics.getConsumedCount().increment(); }
@Override public synchronized void acknowledge(final ConnectionContext context, final MessageAck ack) throws Exception { this.lastAckTime = System.currentTimeMillis(); subscriptionStatistics.getConsumedCount().increment(); }
public void increment() { if (isEnabled()) { counter.incrementAndGet(); updateSampleTime(); if (parent != null) { parent.increment(); } } }
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 messageExpired(ConnectionContext context, Subscription subs, MessageReference reference) { LOG.debug("message expired: {}", reference); broker.messageExpired(context, reference, subs); destinationStatistics.getExpired().increment(); try { removeMessage(context, subs, (QueueMessageReference) reference); messagesLock.writeLock().lock(); try { messages.rollback(reference.getMessageId()); } finally { messagesLock.writeLock().unlock(); } } catch (IOException e) { LOG.error("Failed to remove expired Message from the store ", e); } }
private void incrementAndAddSizeToStoreStat(final long size, final MessageStoreStatistics storedStoreStats) { storedStoreStats.getMessageCount().increment(); if (size > 0) { storedStoreStats.getMessageSize().addSize(size); } }
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(); } } }
public void onMessage() { if (enabled) { long start = messageCount.getLastSampleTime(); messageCount.increment(); long end = messageCount.getLastSampleTime(); messageRateTime.addTime(end - start); } }
protected static final void incMessageStoreStatistics(final MessageStoreStatistics stats, final Message message) { if (stats != null && message != null) { stats.getMessageCount().increment(); stats.getMessageSize().addSize(message.getSize()); } }
protected void incrementAndAddSizeToStoreStat(String kahaDestKey, String subKey, long size) { if (enableSubscriptionStatistics) { MessageStoreSubscriptionStatistics subStats = getSubStats(kahaDestKey); if (subStats != null && subKey != null) { subStats.getMessageCount(subKey).increment(); if (size > 0) { subStats.getMessageSize(subKey).addSize(size); } } } }
@Override public void onCompletion(FutureResponse resp) { try { Response reply = resp.getResult(); reply.setCorrelationId(correlationId); remoteBroker.oneway(reply); //increment counter when messages are received in duplex mode networkBridgeStatistics.getReceivedCount().increment(); } catch (IOException error) { LOG.error("Exception: {} on duplex forward of: {}", error, message); serviceRemoteException(error); } } });
@Override public void onFailure() { Destination nodeDest = (Destination) node.getRegionDestination(); if (nodeDest != null) { if (node != QueueMessageReference.NULL_MESSAGE) { nodeDest.getDestinationStatistics().getDispatched().increment(); nodeDest.getDestinationStatistics().getInflight().increment(); LOG.trace("{} failed to dispatch: {} - {}, dispatched: {}, inflight: {}", new Object[]{ info.getConsumerId(), message.getMessageId(), message.getDestination(), getSubscriptionStatistics().getDispatched().getCount(), dispatched.size() }); } } if (node instanceof QueueMessageReference) { ((QueueMessageReference) node).unlock(); } } });
@Override public void updateMessage(Message message) { synchronized (messageTable) { Message original = messageTable.get(message.getMessageId()); // if can't be found then increment count, else remove old size if (original == null) { getMessageStoreStatistics().getMessageCount().increment(); } else { getMessageStoreStatistics().getMessageSize().addSize(-original.getSize()); } messageTable.put(message.getMessageId(), message); getMessageStoreStatistics().getMessageSize().addSize(message.getSize()); } }
@Override protected void acknowledge(ConnectionContext context, MessageAck ack, MessageReference node) throws IOException { this.setTimeOfLastMessageAck(System.currentTimeMillis()); Destination regionDestination = (Destination) node.getRegionDestination(); regionDestination.acknowledge(context, this, ack, node); redeliveredMessages.remove(node.getMessageId()); node.decrementReferenceCount(); ((Destination)node.getRegionDestination()).getDestinationStatistics().getDequeues().increment(); if (info.isNetworkSubscription()) { ((Destination)node.getRegionDestination()).getDestinationStatistics().getForwards().add(ack.getMessageCount()); } }
@Override public void afterCommit() throws Exception { Destination nodeDest = (Destination) node.getRegionDestination(); synchronized (dispatchLock) { getSubscriptionStatistics().getDequeues().increment(); if (dispatched.remove(node)) { // if consumer is removed, dispatched will be empty and inflight will // already have been adjusted getSubscriptionStatistics().getInflightMessageSize().addSize(-node.getSize()); nodeDest.getDestinationStatistics().getInflight().decrement(); } } contractPrefetchExtension(1); nodeDest.wakeup(); dispatchPending(); }