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

@ -46,46 +46,48 @@ public class DestinationView {
}
public void gc(){
public void gc() {
destination.gc();
}
public String getName() {
return destination.getActiveMQDestination().getPhysicalName();
return destination.getName();
}
public void resetStatistics(){
destination.getDestinationStatistics().reset();
public void resetStatistics() {
destination.resetStatistics();
}
public long getEnqueueCount(){
return destination.getDestinationStatistics().getEnqueues().getCount();
public long getEnqueueCount() {
return destination.getEnqueueCount();
}
public long getDequeueCount(){
return destination.getDestinationStatistics().getDequeues().getCount();
public long getDequeueCount() {
return destination.getDequeueCount();
}
public long getConsumerCount(){
return destination.getDestinationStatistics().getConsumers().getCount();
public long getConsumerCount() {
return destination.getConsumerCount();
}
public long getQueueSize(){
return destination.getDestinationStatistics().getMessages().getCount();
public long getQueueSize() {
return destination.getQueueSize();
}
public long getMessagesCached(){
return destination.getDestinationStatistics().getMessagesCached().getCount();
public long getMessagesCached() {
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

@ -391,7 +391,48 @@ public class Queue implements Destination {
public void setMessageGroupHashBucketCount(int messageGroupHashBucketCount) {
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 {