git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1403496 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-10-29 20:50:35 +00:00
parent 8f19af70f4
commit 90eb05c0fb
2 changed files with 49 additions and 36 deletions

View File

@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.InvalidSelectorException; import javax.jms.InvalidSelectorException;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
@ -35,6 +36,7 @@ import javax.management.openmbean.OpenDataException;
import javax.management.openmbean.TabularData; import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport; import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType; import javax.management.openmbean.TabularType;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.jmx.OpenTypeSupport.OpenTypeFactory; import org.apache.activemq.broker.jmx.OpenTypeSupport.OpenTypeFactory;
import org.apache.activemq.broker.region.Destination; import org.apache.activemq.broker.region.Destination;
@ -109,6 +111,10 @@ public class DestinationView implements DestinationViewMBean {
return destination.getMemoryUsage().getPercentUsage(); return destination.getMemoryUsage().getPercentUsage();
} }
public long getMemoryUsageByteCount() {
return destination.getMemoryUsage().getUsage();
}
public long getMemoryLimit() { public long getMemoryLimit() {
return destination.getMemoryUsage().getLimit(); return destination.getMemoryUsage().getLimit();
} }

View File

@ -19,6 +19,7 @@ package org.apache.activemq.broker.jmx;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.jms.InvalidSelectorException; import javax.jms.InvalidSelectorException;
import javax.management.MalformedObjectNameException; import javax.management.MalformedObjectNameException;
import javax.management.ObjectName; import javax.management.ObjectName;
@ -42,7 +43,7 @@ public interface DestinationViewMBean {
/** /**
* Returns the number of messages that have been sent to the destination. * Returns the number of messages that have been sent to the destination.
* *
* @return The number of messages that have been sent to the destination. * @return The number of messages that have been sent to the destination.
*/ */
@MBeanInfo("Number of messages that have been sent to the destination.") @MBeanInfo("Number of messages that have been sent to the destination.")
@ -51,7 +52,7 @@ public interface DestinationViewMBean {
/** /**
* Returns the number of messages that have been delivered (potentially not * Returns the number of messages that have been delivered (potentially not
* acknowledged) to consumers. * acknowledged) to consumers.
* *
* @return The number of messages that have been delivered (potentially not * @return The number of messages that have been delivered (potentially not
* acknowledged) to consumers. * acknowledged) to consumers.
*/ */
@ -61,17 +62,17 @@ public interface DestinationViewMBean {
/** /**
* Returns the number of messages that have been acknowledged from the * Returns the number of messages that have been acknowledged from the
* destination. * destination.
* *
* @return The number of messages that have been acknowledged from the * @return The number of messages that have been acknowledged from the
* destination. * destination.
*/ */
@MBeanInfo("Number of messages that have been acknowledged (and removed from) from the destination.") @MBeanInfo("Number of messages that have been acknowledged (and removed from) from the destination.")
long getDequeueCount(); long getDequeueCount();
/** /**
* Returns the number of messages that have been dispatched but not * Returns the number of messages that have been dispatched but not
* acknowledged * acknowledged
* *
* @return The number of messages that have been dispatched but not * @return The number of messages that have been dispatched but not
* acknowledged * acknowledged
*/ */
@ -80,20 +81,20 @@ public interface DestinationViewMBean {
/** /**
* Returns the number of messages that have expired * Returns the number of messages that have expired
* *
* @return The number of messages that have expired * @return The number of messages that have expired
*/ */
@MBeanInfo("Number of messages that have been expired.") @MBeanInfo("Number of messages that have been expired.")
long getExpiredCount(); long getExpiredCount();
/** /**
* Returns the number of consumers subscribed this destination. * Returns the number of consumers subscribed this destination.
* *
* @return The number of consumers subscribed this destination. * @return The number of consumers subscribed this destination.
*/ */
@MBeanInfo("Number of consumers subscribed to this destination.") @MBeanInfo("Number of consumers subscribed to this destination.")
long getConsumerCount(); long getConsumerCount();
/** /**
* @return the number of producers publishing to the destination * @return the number of producers publishing to the destination
*/ */
@ -103,7 +104,7 @@ public interface DestinationViewMBean {
/** /**
* Returns the number of messages in this destination which are yet to be * Returns the number of messages in this destination which are yet to be
* consumed * consumed
* *
* @return Returns the number of messages in this destination which are yet * @return Returns the number of messages in this destination which are yet
* to be consumed * to be consumed
*/ */
@ -138,7 +139,7 @@ public interface DestinationViewMBean {
/** /**
* Sends a TextMesage to the destination. * Sends a TextMesage to the destination.
* *
* @param body the text to send * @param body the text to send
* @return the message id of the message sent. * @return the message id of the message sent.
* @throws Exception * @throws Exception
@ -148,7 +149,7 @@ public interface DestinationViewMBean {
/** /**
* Sends a TextMesage to the destination. * Sends a TextMesage to the destination.
* *
* @param headers the message headers and properties to set. Can only * @param headers the message headers and properties to set. Can only
* container Strings maped to primitive types. * container Strings maped to primitive types.
* @param body the text to send * @param body the text to send
@ -168,9 +169,9 @@ public interface DestinationViewMBean {
*/ */
@MBeanInfo("Sends a TextMessage to a password-protected destination.") @MBeanInfo("Sends a TextMessage to a password-protected destination.")
String sendTextMessage(@MBeanInfo("body") String body, @MBeanInfo("user") String user, @MBeanInfo("password") String password) throws Exception; String sendTextMessage(@MBeanInfo("body") String body, @MBeanInfo("user") String user, @MBeanInfo("password") String password) throws Exception;
/** /**
* *
* @param headers the message headers and properties to set. Can only * @param headers the message headers and properties to set. Can only
* container Strings maped to primitive types. * container Strings maped to primitive types.
* @param body the text to send * @param body the text to send
@ -187,6 +188,12 @@ public interface DestinationViewMBean {
@MBeanInfo("The percentage of the memory limit used") @MBeanInfo("The percentage of the memory limit used")
int getMemoryPercentUsage(); int getMemoryPercentUsage();
/**
* @return the amount of memory currently used by this destination
*/
@MBeanInfo("Memory usage, in bytes, used by undelivered messages")
long getMemoryUsageByteCount();
/** /**
* @return the amount of memory allocated to this destination * @return the amount of memory allocated to this destination
*/ */
@ -198,13 +205,13 @@ public interface DestinationViewMBean {
* @param limit * @param limit
*/ */
void setMemoryLimit(long limit); void setMemoryLimit(long limit);
/** /**
* @return the portion of memory from the broker memory limit for this destination * @return the portion of memory from the broker memory limit for this destination
*/ */
@MBeanInfo("Portion of memory from the broker memory limit for this destination") @MBeanInfo("Portion of memory from the broker memory limit for this destination")
float getMemoryUsagePortion(); float getMemoryUsagePortion();
/** /**
* set the portion of memory from the broker memory limit for this destination * set the portion of memory from the broker memory limit for this destination
* @param value * @param value
@ -241,94 +248,94 @@ public interface DestinationViewMBean {
*/ */
@MBeanInfo("Average time a message has been held this destination.") @MBeanInfo("Average time a message has been held this destination.")
double getAverageEnqueueTime(); double getAverageEnqueueTime();
/** /**
* @return the producerFlowControl * @return the producerFlowControl
*/ */
@MBeanInfo("Producers are flow controlled") @MBeanInfo("Producers are flow controlled")
boolean isProducerFlowControl(); boolean isProducerFlowControl();
/** /**
* @param producerFlowControl the producerFlowControl to set * @param producerFlowControl the producerFlowControl to set
*/ */
public void setProducerFlowControl(@MBeanInfo("producerFlowControl") boolean producerFlowControl); public void setProducerFlowControl(@MBeanInfo("producerFlowControl") boolean producerFlowControl);
/** /**
* @return if we treat consumers as alwaysRetroactive * @return if we treat consumers as alwaysRetroactive
*/ */
@MBeanInfo("Always treat consumers as retroActive") @MBeanInfo("Always treat consumers as retroActive")
boolean isAlwaysRetroactive(); boolean isAlwaysRetroactive();
/** /**
* @param alwaysRetroactive set as always retroActive * @param alwaysRetroactive set as always retroActive
*/ */
public void setAlwaysRetroactive(@MBeanInfo("alwaysRetroactive") boolean alwaysRetroactive); public void setAlwaysRetroactive(@MBeanInfo("alwaysRetroactive") boolean alwaysRetroactive);
/** /**
* Set's the interval at which warnings about producers being blocked by * Set's the interval at which warnings about producers being blocked by
* resource usage will be triggered. Values of 0 or less will disable * resource usage will be triggered. Values of 0 or less will disable
* warnings * warnings
* *
* @param blockedProducerWarningInterval the interval at which warning about * @param blockedProducerWarningInterval the interval at which warning about
* blocked producers will be triggered. * blocked producers will be triggered.
*/ */
public void setBlockedProducerWarningInterval(@MBeanInfo("blockedProducerWarningInterval") long blockedProducerWarningInterval); public void setBlockedProducerWarningInterval(@MBeanInfo("blockedProducerWarningInterval") long blockedProducerWarningInterval);
/** /**
* *
* @return the interval at which warning about blocked producers will be * @return the interval at which warning about blocked producers will be
* triggered. * triggered.
*/ */
@MBeanInfo("Blocked Producer Warning Interval") @MBeanInfo("Blocked Producer Warning Interval")
public long getBlockedProducerWarningInterval(); public long getBlockedProducerWarningInterval();
/** /**
* @return the maxProducersToAudit * @return the maxProducersToAudit
*/ */
@MBeanInfo("Maximum number of producers to audit") @MBeanInfo("Maximum number of producers to audit")
public int getMaxProducersToAudit(); public int getMaxProducersToAudit();
/** /**
* @param maxProducersToAudit the maxProducersToAudit to set * @param maxProducersToAudit the maxProducersToAudit to set
*/ */
public void setMaxProducersToAudit(@MBeanInfo("maxProducersToAudit") int maxProducersToAudit); public void setMaxProducersToAudit(@MBeanInfo("maxProducersToAudit") int maxProducersToAudit);
/** /**
* @return the maxAuditDepth * @return the maxAuditDepth
*/ */
@MBeanInfo("Max audit depth") @MBeanInfo("Max audit depth")
public int getMaxAuditDepth(); public int getMaxAuditDepth();
/** /**
* @param maxAuditDepth the maxAuditDepth to set * @param maxAuditDepth the maxAuditDepth to set
*/ */
public void setMaxAuditDepth(@MBeanInfo("maxAuditDepth") int maxAuditDepth); public void setMaxAuditDepth(@MBeanInfo("maxAuditDepth") int maxAuditDepth);
/** /**
* @return the maximum number of message to be paged into the * @return the maximum number of message to be paged into the
* destination * destination
*/ */
@MBeanInfo("Maximum number of messages to be paged in") @MBeanInfo("Maximum number of messages to be paged in")
public int getMaxPageSize(); public int getMaxPageSize();
/** /**
* @param pageSize * @param pageSize
* Set the maximum number of messages to page into the destination * Set the maximum number of messages to page into the destination
*/ */
public void setMaxPageSize(@MBeanInfo("pageSize") int pageSize); public void setMaxPageSize(@MBeanInfo("pageSize") int pageSize);
/** /**
* @return true if caching is allowed of for the destination * @return true if caching is allowed of for the destination
*/ */
@MBeanInfo("Caching is allowed") @MBeanInfo("Caching is allowed")
public boolean isUseCache(); public boolean isUseCache();
/** /**
* @return true if prioritized messages are enabled for the destination * @return true if prioritized messages are enabled for the destination
*/ */
@MBeanInfo("Prioritized messages is enabled") @MBeanInfo("Prioritized messages is enabled")
public boolean isPrioritizedMessages(); public boolean isPrioritizedMessages();
/** /**
* @param value * @param value
* enable/disable caching on the destination * enable/disable caching on the destination
@ -337,7 +344,7 @@ public interface DestinationViewMBean {
/** /**
* Returns all the current subscription MBeans matching this destination * Returns all the current subscription MBeans matching this destination
* *
* @return the names of the subscriptions for this destination * @return the names of the subscriptions for this destination
*/ */
@MBeanInfo("returns all the current subscription MBeans matching this destination") @MBeanInfo("returns all the current subscription MBeans matching this destination")