diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java index 9e41138ce1..7476c3ec9e 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java @@ -120,7 +120,7 @@ public class StatisticsBroker extends BrokerFilter { statsMessage.setLong("inflightCount", stats.getInflight().getCount()); statsMessage.setLong("messagesCached", stats.getMessagesCached().getCount()); // we are okay with the size without decimals so cast to long - statsMessage.setLong("averageMessageSize", (long) stats.getMessageSize().getAveragePerSecond()); + statsMessage.setLong("averageMessageSize", (long) stats.getMessageSize().getAverageSize()); statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage()); statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage()); statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit()); diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java index b2e4bddfe5..b003a161e7 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java @@ -117,6 +117,8 @@ public class BrokerStatisticsPluginTest extends TestCase{ assertTrue(reply.getMapNames().hasMoreElements()); assertTrue(reply.getJMSTimestamp() > 0); assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority()); + assertTrue(reply.getLong("averageMessageSize") > 0); + /* for (Enumeration e = reply.getMapNames();e.hasMoreElements();) { String name = e.nextElement().toString();