activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [17/29] git commit: https://issues.apache.org/jira/browse/AMQ-5011
Date Thu, 20 Mar 2014 17:44:28 GMT
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/b6d396a1
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/b6d396a1
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/b6d396a1

Branch: refs/heads/activemq-5.9
Commit: b6d396a18b53344b73f561ec1f4e8519dec58b8f
Parents: 90e9193
Author: Timothy Bish <tabish121@gmai.com>
Authored: Fri Jan 31 17:23:21 2014 -0500
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Thu Mar 20 13:11:16 2014 -0400

----------------------------------------------------------------------
 .../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/b6d396a1/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/b6d396a1/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();


Mime
View raw message