activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [13/13] git commit: Merge for fix for AMQ-4927
Date Thu, 13 Mar 2014 15:49:13 GMT
Merge for fix for AMQ-4927


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

Branch: refs/heads/activemq-5.9
Commit: 88959d5c653b78df4c629b380f7215129f08228a
Parents: 6d236b0
Author: Hadrian Zbarcea <hadrian@apache.org>
Authored: Thu Mar 13 11:20:51 2014 -0400
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Thu Mar 13 11:20:51 2014 -0400

----------------------------------------------------------------------
 .../apache/activemq/broker/jmx/ProducerView.java |  4 ++--
 .../activemq/broker/jmx/ProducerViewMBean.java   |  2 +-
 .../activemq/broker/jmx/SubscriptionView.java    |  4 ++--
 .../activemq/broker/region/AbstractRegion.java   |  3 ++-
 .../broker/region/AbstractSubscription.java      | 19 +++++++++++++------
 .../activemq/broker/region/Subscription.java     | 14 +++++++-------
 .../apache/activemq/command/ProducerInfo.java    | 17 +++++++++++++----
 .../region/QueueDuplicatesFromStoreTest.java     | 12 ++++++++++--
 8 files changed, 50 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
index 6905c72..e211b75 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerView.java
@@ -188,12 +188,12 @@ public class ProducerView implements ProducerViewMBean {
     @Override
     public void resetStatistics() {
        if (info != null){
-           info.getSentCount().reset();
+           info.resetSentCount();
        }
     }
 
     @Override
     public long getSentCount() {
-        return info != null ? info.getSentCount().getCount() :0;
+        return info != null ? info.getSentCount() :0;
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
index 14c2073..4776283 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ProducerViewMBean.java
@@ -102,7 +102,7 @@ public interface ProducerViewMBean {
     @MBeanInfo("Resets statistics.")
     void resetStatistics();
 
-    @MBeanInfo("Messages consumed")
+    @MBeanInfo("Messages dispatched by Producer")
     long getSentCount();
 
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
index 443a266..deefdb4 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java
@@ -421,12 +421,12 @@ public class SubscriptionView implements SubscriptionViewMBean {
     @Override
     public void resetStatistics() {
         if (subscription != null){
-            subscription.getConsumedCount().reset();
+            subscription.resetConsumedCount();
         }
     }
 
     @Override
     public long getConsumedCount() {
-        return subscription != null ? subscription.getConsumedCount().getCount() : 0;
+        return subscription != null ? subscription.getConsumedCount() : 0;
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
index 16deed4..efa02cb 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
@@ -392,8 +392,9 @@ public abstract class AbstractRegion implements Region {
         }
 
         producerExchange.getRegionDestination().send(producerExchange, messageSend);
+
         if (producerExchange.getProducerState() != null && producerExchange.getProducerState().getInfo()
!= null){
-            producerExchange.getProducerState().getInfo().getSentCount().increment();
+            producerExchange.getProducerState().getInfo().incrementSentCount();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
index b2ff01c..3a2e2ee 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/AbstractSubscription.java
@@ -20,11 +20,11 @@ import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicLong;
 
 import javax.jms.InvalidSelectorException;
 import javax.jms.JMSException;
 import javax.management.ObjectName;
-
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -36,7 +36,6 @@ import org.apache.activemq.filter.DestinationFilter;
 import org.apache.activemq.filter.LogicExpression;
 import org.apache.activemq.filter.MessageEvaluationContext;
 import org.apache.activemq.filter.NoLocalExpression;
-import org.apache.activemq.management.CountStatisticImpl;
 import org.apache.activemq.selector.SelectorParser;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,7 +53,7 @@ public abstract class AbstractSubscription implements Subscription {
     private int cursorMemoryHighWaterMark = 70;
     private boolean slowConsumer;
     private long lastAckTime;
-    private CountStatisticImpl consumedCount = new CountStatisticImpl("consumed","The number
of messages consumed");
+    private AtomicLong consumedCount = new AtomicLong();
 
     public AbstractSubscription(Broker broker,ConnectionContext context, ConsumerInfo info)
throws InvalidSelectorException {
         this.broker = broker;
@@ -90,7 +89,7 @@ public abstract class AbstractSubscription implements Subscription {
     @Override
     public synchronized void acknowledge(final ConnectionContext context, final MessageAck
ack) throws Exception {
         this.lastAckTime = System.currentTimeMillis();
-        this.consumedCount.increment();
+        this.consumedCount.incrementAndGet();
     }
 
     @Override
@@ -280,7 +279,15 @@ public abstract class AbstractSubscription implements Subscription {
         this.lastAckTime = value;
     }
 
-    public CountStatisticImpl getConsumedCount(){
-        return consumedCount;
+    public long getConsumedCount(){
+        return consumedCount.get();
+    }
+
+    public void incrementConsumedCount(){
+        consumedCount.incrementAndGet();
+    }
+
+    public void resetConsumedCount(){
+        consumedCount.set(0);
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-broker/src/main/java/org/apache/activemq/broker/region/Subscription.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Subscription.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Subscription.java
index b79b37e..a2c4502 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Subscription.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Subscription.java
@@ -21,7 +21,6 @@ import java.util.List;
 
 import javax.jms.InvalidSelectorException;
 import javax.management.ObjectName;
-
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConsumerInfo;
@@ -30,7 +29,6 @@ import org.apache.activemq.command.MessageDispatchNotification;
 import org.apache.activemq.command.MessagePull;
 import org.apache.activemq.command.Response;
 import org.apache.activemq.filter.MessageEvaluationContext;
-import org.apache.activemq.management.CountStatisticImpl;
 
 /**
  *
@@ -48,7 +46,6 @@ public interface Subscription extends SubscriptionRecovery {
 
     /**
      * Used when client acknowledge receipt of dispatched message.
-     * @param node
      * @throws IOException
      * @throws Exception
      */
@@ -70,7 +67,7 @@ public interface Subscription extends SubscriptionRecovery {
 
     /**
      * Is the subscription interested in messages in the destination?
-     * @param context
+     * @param destination
      * @return
      */
     boolean matches(ActiveMQDestination destination);
@@ -93,7 +90,6 @@ public interface Subscription extends SubscriptionRecovery {
 
     /**
      * The ConsumerInfo object that created the subscription.
-     * @param destination
      */
     ConsumerInfo getConsumerInfo();
 
@@ -200,7 +196,7 @@ public interface Subscription extends SubscriptionRecovery {
     /**
      * Informs the Broker if the subscription needs to intervention to recover it's state
      * e.g. DurableTopicSubscriber may do
-     * @see org.apache.activemq.region.cursors.PendingMessageCursor
+     * @see org.apache.activemq.broker.region.cursors.PendingMessageCursor
      * @return true if recovery required
      */
     boolean isRecoveryRequired();
@@ -235,6 +231,10 @@ public interface Subscription extends SubscriptionRecovery {
      */
     long getTimeOfLastMessageAck();
 
-    CountStatisticImpl getConsumedCount();
+    long  getConsumedCount();
+
+    void incrementConsumedCount();
+
+    void resetConsumedCount();
 
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-client/src/main/java/org/apache/activemq/command/ProducerInfo.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ProducerInfo.java b/activemq-client/src/main/java/org/apache/activemq/command/ProducerInfo.java
index 05ef3a4..7189347 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/ProducerInfo.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/ProducerInfo.java
@@ -16,7 +16,8 @@
  */
 package org.apache.activemq.command;
 
-import org.apache.activemq.management.CountStatisticImpl;
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.activemq.state.CommandVisitor;
 
 /**
@@ -33,7 +34,7 @@ public class ProducerInfo extends BaseCommand {
     protected BrokerId[] brokerPath;
     protected boolean dispatchAsync;
     protected int windowSize;
-    protected CountStatisticImpl sentCount = new CountStatisticImpl("sentCount","number of
messages sent to a broker");
+    protected AtomicLong sentCount = new AtomicLong();
 
     public ProducerInfo() {
     }
@@ -137,8 +138,16 @@ public class ProducerInfo extends BaseCommand {
         this.windowSize = windowSize;
     }
 
-    public CountStatisticImpl getSentCount(){
-        return sentCount;
+    public long getSentCount(){
+        return sentCount.get();
+    }
+
+    public void incrementSentCount(){
+        sentCount.incrementAndGet();
+    }
+
+    public void resetSentCount(){
+        sentCount.set(0);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/88959d5c/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
index 9da839d..e9c6664 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
@@ -342,8 +342,16 @@ public class QueueDuplicatesFromStoreTest extends TestCase {
             }
 
             @Override
-            public CountStatisticImpl getConsumedCount() {
-                return null;
+            public long getConsumedCount() {
+                return 0;
+            }
+
+            public void incrementConsumedCount(){
+
+            }
+
+            public void resetConsumedCount(){
+
             }
         };
 


Mime
View raw message