1 18 19 package org.apache.activemq.broker.region; 20 import org.apache.activemq.management.CountStatisticImpl; 21 import org.apache.activemq.management.PollCountStatisticImpl; 22 import org.apache.activemq.management.StatsImpl; 23 24 29 public class ConnectorStatistics extends StatsImpl { 30 31 protected CountStatisticImpl enqueues; 32 protected CountStatisticImpl dequeues; 33 protected CountStatisticImpl consumers; 34 protected CountStatisticImpl messages; 35 protected PollCountStatisticImpl messagesCached; 36 37 public ConnectorStatistics() { 38 39 enqueues = new CountStatisticImpl("enqueues", "The number of messages that have been sent to the destination"); 40 dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been dispatched from the destination"); 41 consumers = new CountStatisticImpl("consumers", "The number of consumers that that are subscribing to messages from the destination"); 42 messages = new CountStatisticImpl("messages", "The number of messages that that are being held by the destination"); 43 messagesCached = new PollCountStatisticImpl("messagesCached", "The number of messages that are held in the destination's memory cache"); 44 45 addStatistic("enqueues", enqueues); 46 addStatistic("dequeues", dequeues); 47 addStatistic("consumers", consumers); 48 addStatistic("messages", messages); 49 addStatistic("messagesCached", messagesCached); 50 } 51 52 public CountStatisticImpl getEnqueues() { 53 return enqueues; 54 } 55 public CountStatisticImpl getDequeues() { 56 return dequeues; 57 } 58 public CountStatisticImpl getConsumers() { 59 return consumers; 60 } 61 public PollCountStatisticImpl getMessagesCached() { 62 return messagesCached; 63 } 64 public CountStatisticImpl getMessages() { 65 return messages; 66 } 67 68 public void reset() { 69 super.reset(); 70 enqueues.reset(); 71 dequeues.reset(); 72 } 73 74 public void setEnabled(boolean enabled) { 75 super.setEnabled(enabled); 76 enqueues.setEnabled(enabled); 77 dequeues.setEnabled(enabled); 78 consumers.setEnabled(enabled); 79 messages.setEnabled(enabled); 80 messagesCached.setEnabled(enabled); 81 } 82 83 public void setParent(ConnectorStatistics parent) { 84 if( parent!=null ) { 85 enqueues.setParent(parent.enqueues); 86 dequeues.setParent(parent.dequeues); 87 consumers.setParent(parent.consumers); 88 messagesCached.setParent(parent.messagesCached); 89 messages.setParent(parent.messages); 90 } else { 91 enqueues.setParent(null); 92 dequeues.setParent(null); 93 consumers.setParent(null); 94 messagesCached.setParent(null); 95 messages.setParent(null); 96 } 97 } 98 99 public void setMessagesCached(PollCountStatisticImpl messagesCached) { 100 this.messagesCached = messagesCached; 101 } 102 } 103 | Popular Tags |