activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-5743 - confine logging to the jmx purge op
Date Fri, 24 Apr 2015 12:32:45 GMT
Repository: activemq
Updated Branches:
  refs/heads/master b8698953f -> 23ecbe80d


https://issues.apache.org/jira/browse/AMQ-5743 - confine logging to the jmx purge op


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/23ecbe80
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/23ecbe80
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/23ecbe80

Branch: refs/heads/master
Commit: 23ecbe80d0f775c85a3a4291dcd4c4ca74d02914
Parents: b869895
Author: gtully <gary.tully@gmail.com>
Authored: Fri Apr 24 13:35:02 2015 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Fri Apr 24 13:35:02 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/activemq/broker/jmx/QueueView.java  | 8 ++++++++
 .../main/java/org/apache/activemq/broker/region/Queue.java   | 2 --
 .../org/apache/activemq/broker/region/QueuePurgeTest.java    | 4 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/23ecbe80/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/QueueView.java b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
index 076b4fc..4ae081e 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
@@ -28,11 +28,15 @@ import org.apache.activemq.broker.region.QueueMessageReference;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.Message;
 import org.apache.activemq.util.BrokerSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Provides a JMX Management view of a Queue.
  */
 public class QueueView extends DestinationView implements QueueViewMBean {
+    private static final Logger LOG = LoggerFactory.getLogger(QueueView.class);
+
     public QueueView(ManagedRegionBroker broker, Queue destination) {
         super(broker, destination);
     }
@@ -53,7 +57,11 @@ public class QueueView extends DestinationView implements QueueViewMBean
{
     }
 
     public void purge() throws Exception {
+        final long originalMessageCount = destination.getDestinationStatistics().getMessages().getCount();
+
         ((Queue)destination).purge();
+
+        LOG.info("{} purge of {} messages", destination.getActiveMQDestination().getQualifiedName(),
originalMessageCount);
     }
 
     public boolean removeMessage(String messageId) throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq/blob/23ecbe80/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
index 8d12a8b..232a7ba 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java
@@ -1233,8 +1233,6 @@ public class Queue extends BaseDestination implements Task, UsageListener,
Index
 
         if (this.destinationStatistics.getMessages().getCount() > 0) {
             LOG.warn("{} after purge of {} messages, message count stats report: {}", getActiveMQDestination().getQualifiedName(),
originalMessageCount, this.destinationStatistics.getMessages().getCount());
-        } else {
-            LOG.info("{} purged of {} messages", getActiveMQDestination().getQualifiedName(),
originalMessageCount);
         }
         gc();
         this.destinationStatistics.getMessages().setCount(0);

http://git-wip-us.apache.org/repos/asf/activemq/blob/23ecbe80/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
index 9120937..a121619 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
@@ -95,7 +95,7 @@ public class QueuePurgeTest extends CombinationTestSupport {
         QueueViewMBean proxy = getProxyToQueueViewMBean();
         LOG.info("purging..");
 
-        org.apache.log4j.Logger log4jLogger = org.apache.log4j.Logger.getLogger(org.apache.activemq.broker.region.Queue.class);
+        org.apache.log4j.Logger log4jLogger = org.apache.log4j.Logger.getLogger(org.apache.activemq.broker.jmx.QueueView.class);
         final AtomicBoolean gotPurgeLogMessage = new AtomicBoolean(false);
 
         Appender appender = new DefaultTestAppender() {
@@ -103,7 +103,7 @@ public class QueuePurgeTest extends CombinationTestSupport {
             public void doAppend(LoggingEvent event) {
                 if (event.getMessage() instanceof String) {
                     String message = (String) event.getMessage();
-                    if (message.contains("purged of " + NUM_TO_SEND +" messages")) {
+                    if (message.contains("purge of " + NUM_TO_SEND +" messages")) {
                         LOG.info("Received a log message: {} ", event.getMessage());
                         gotPurgeLogMessage.set(true);
                     }


Mime
View raw message