added helper methods to Destination POJOs so the MBeans are not required

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@399298 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-05-03 13:38:26 +00:00
parent 91732843ea
commit 44493e4997
4 changed files with 112 additions and 17 deletions

View File

@ -51,41 +51,43 @@ public class DestinationView {
}
public String getName() {
return destination.getActiveMQDestination().getPhysicalName();
return destination.getName();
}
public void resetStatistics() {
destination.getDestinationStatistics().reset();
destination.resetStatistics();
}
public long getEnqueueCount() {
return destination.getDestinationStatistics().getEnqueues().getCount();
return destination.getEnqueueCount();
}
public long getDequeueCount() {
return destination.getDestinationStatistics().getDequeues().getCount();
return destination.getDequeueCount();
}
public long getConsumerCount() {
return destination.getDestinationStatistics().getConsumers().getCount();
return destination.getConsumerCount();
}
public long getQueueSize() {
return destination.getDestinationStatistics().getMessages().getCount();
return destination.getQueueSize();
}
public long getMessagesCached() {
return destination.getDestinationStatistics().getMessagesCached().getCount();
return destination.getMessagesCached();
}
public int getMemoryPercentageUsed() {
return destination.getUsageManager().getPercentUsage();
return destination.getMemoryPercentageUsed();
}
public long getMemoryLimit() {
return destination.getUsageManager().getLimit();
return destination.getMemoryLimit();
}
public void setMemoryLimit(long limit) {
destination.getUsageManager().setLimit(limit);
destination.setMemoryLimit(limit);
}
public CompositeData[] browse() throws OpenDataException{

View File

@ -54,4 +54,15 @@ public interface Destination extends Service {
DeadLetterStrategy getDeadLetterStrategy();
public Message[] browse();
public void resetStatistics();
public String getName();
public long getEnqueueCount();
public long getDequeueCount();
public long getConsumerCount();
public long getQueueSize();
public long getMessagesCached();
public int getMemoryPercentageUsed();
public long getMemoryLimit();
public void setMemoryLimit(long limit);
}

View File

@ -392,6 +392,47 @@ public class Queue implements Destination {
this.messageGroupHashBucketCount = messageGroupHashBucketCount;
}
public void resetStatistics() {
getDestinationStatistics().reset();
}
public String getName() {
return getActiveMQDestination().getPhysicalName();
}
public long getEnqueueCount() {
return getDestinationStatistics().getEnqueues().getCount();
}
public long getDequeueCount() {
return getDestinationStatistics().getDequeues().getCount();
}
public long getConsumerCount() {
return getDestinationStatistics().getConsumers().getCount();
}
public long getQueueSize() {
return getDestinationStatistics().getMessages().getCount();
}
public long getMessagesCached() {
return getDestinationStatistics().getMessagesCached().getCount();
}
public int getMemoryPercentageUsed() {
return getUsageManager().getPercentUsage();
}
public long getMemoryLimit() {
return getUsageManager().getLimit();
}
public void setMemoryLimit(long limit) {
getUsageManager().setLimit(limit);
}
// Implementation methods
// -------------------------------------------------------------------------
private MessageReference createMessageReference(Message message) {

View File

@ -379,6 +379,47 @@ public class Topic implements Destination {
this.deadLetterStrategy = deadLetterStrategy;
}
public void resetStatistics(){
getDestinationStatistics().reset();
}
public String getName() {
return getActiveMQDestination().getPhysicalName();
}
public long getEnqueueCount() {
return getDestinationStatistics().getEnqueues().getCount();
}
public long getDequeueCount() {
return getDestinationStatistics().getDequeues().getCount();
}
public long getConsumerCount() {
return getDestinationStatistics().getConsumers().getCount();
}
public long getQueueSize() {
return getDestinationStatistics().getMessages().getCount();
}
public long getMessagesCached() {
return getDestinationStatistics().getMessagesCached().getCount();
}
public int getMemoryPercentageUsed() {
return getUsageManager().getPercentUsage();
}
public long getMemoryLimit() {
return getUsageManager().getLimit();
}
public void setMemoryLimit(long limit) {
getUsageManager().setLimit(limit);
}
// Implementation methods
// -------------------------------------------------------------------------
protected void dispatch(ConnectionContext context, Message message) throws Exception {