You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/01/31 23:25:41 UTC
git commit: https://issues.apache.org/jira/browse/AMQ-5011
Updated Branches:
refs/heads/trunk f4e768760 -> da3775302
https://issues.apache.org/jira/browse/AMQ-5011
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/da377530
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/da377530
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/da377530
Branch: refs/heads/trunk
Commit: da3775302c68c628138a221409910ff9c4ca48a6
Parents: f4e7687
Author: Timothy Bish <ta...@gmai.com>
Authored: Fri Jan 31 17:23:21 2014 -0500
Committer: Timothy Bish <ta...@gmai.com>
Committed: Fri Jan 31 17:25:26 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/activemq/plugin/StatisticsBroker.java | 6 ++++++
.../activemq/plugin/BrokerStatisticsPluginTest.java | 10 ++++++++++
2 files changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/da377530/activemq-broker/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java
----------------------------------------------------------------------
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 c1949c5..9eabd4f 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
@@ -22,6 +22,7 @@ import java.util.Set;
import javax.jms.JMSException;
import javax.management.ObjectName;
+
import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.BrokerFilter;
@@ -80,6 +81,7 @@ public class StatisticsBroker extends BrokerFilter {
* @see org.apache.activemq.broker.BrokerFilter#send(org.apache.activemq.broker.ProducerBrokerExchange,
* org.apache.activemq.command.Message)
*/
+ @Override
public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception {
ActiveMQDestination msgDest = messageSend.getDestination();
ActiveMQDestination replyTo = messageSend.getReplyTo();
@@ -206,11 +208,13 @@ public class StatisticsBroker extends BrokerFilter {
return this.brokerView;
}
+ @Override
public void start() throws Exception {
super.start();
LOG.info("Starting StatisticsBroker");
}
+ @Override
public void stop() throws Exception {
super.stop();
}
@@ -249,6 +253,8 @@ public class StatisticsBroker extends BrokerFilter {
protected void sendStats(ConnectionContext context, ActiveMQMapMessage msg, ActiveMQDestination replyTo)
throws Exception {
msg.setPersistent(false);
+ msg.setTimestamp(System.currentTimeMillis());
+ msg.setPriority((byte) javax.jms.Message.DEFAULT_PRIORITY);
msg.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
msg.setMessageId(new MessageId(this.advisoryProducerId, this.messageIdGenerator.getNextSequenceId()));
msg.setDestination(replyTo);
http://git-wip-us.apache.org/repos/asf/activemq/blob/da377530/activemq-unit-tests/src/test/java/org/apache/activemq/plugin/BrokerStatisticsPluginTest.java
----------------------------------------------------------------------
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 2b8e7db..f99953a 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
@@ -59,6 +59,8 @@ public class BrokerStatisticsPluginTest extends TestCase{
MapMessage reply = (MapMessage) consumer.receive(10*1000);
assertNotNull(reply);
assertTrue(reply.getMapNames().hasMoreElements());
+ assertTrue(reply.getJMSTimestamp() > 0);
+ assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority());
/*
for (Enumeration e = reply.getMapNames();e.hasMoreElements();) {
String name = e.nextElement().toString();
@@ -93,6 +95,8 @@ public class BrokerStatisticsPluginTest extends TestCase{
assertNotNull(reply);
assertTrue(reply.getMapNames().hasMoreElements());
assertEquals(0, reply.getLong("enqueueCount"));
+ assertTrue(reply.getJMSTimestamp() > 0);
+ assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority());
}
public void testDestinationStats() throws Exception{
@@ -111,6 +115,8 @@ public class BrokerStatisticsPluginTest extends TestCase{
MapMessage reply = (MapMessage) consumer.receive();
assertNotNull(reply);
assertTrue(reply.getMapNames().hasMoreElements());
+ assertTrue(reply.getJMSTimestamp() > 0);
+ assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority());
/*
for (Enumeration e = reply.getMapNames();e.hasMoreElements();) {
String name = e.nextElement().toString();
@@ -137,6 +143,8 @@ public class BrokerStatisticsPluginTest extends TestCase{
MapMessage reply = (MapMessage) consumer.receive();
assertNotNull(reply);
assertTrue(reply.getMapNames().hasMoreElements());
+ assertTrue(reply.getJMSTimestamp() > 0);
+ assertEquals(Message.DEFAULT_PRIORITY, reply.getJMSPriority());
/*for (Enumeration e = reply.getMapNames();e.hasMoreElements();) {
String name = e.nextElement().toString();
@@ -144,6 +152,7 @@ public class BrokerStatisticsPluginTest extends TestCase{
}*/
}
+ @Override
protected void setUp() throws Exception {
broker = createBroker();
ConnectionFactory factory = new ActiveMQConnectionFactory(broker.getTransportConnectorURIsAsMap().get("tcp"));
@@ -151,6 +160,7 @@ public class BrokerStatisticsPluginTest extends TestCase{
connection.start();
}
+ @Override
protected void tearDown() throws Exception{
if (this.connection != null) {
this.connection.close();