activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r697937 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/region/ management/
Date Mon, 22 Sep 2008 18:35:32 GMT
Author: rajdavies
Date: Mon Sep 22 11:35:32 2008
New Revision: 697937

URL: http://svn.apache.org/viewvc?rev=697937&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-1946

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/CountStatisticImpl.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/RangeStatisticImpl.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/TimeStatisticImpl.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java?rev=697937&r1=697936&r2=697937&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/DestinationStatistics.java
Mon Sep 22 11:35:32 2008
@@ -21,6 +21,7 @@
 import org.apache.activemq.management.PollCountStatisticImpl;
 import org.apache.activemq.management.StatsImpl;
 import org.apache.activemq.management.TimeStatisticImpl;
+import org.apache.tools.ant.taskdefs.condition.IsReference;
 
 /**
  * The J2EE Statistics for the a Destination.
@@ -46,7 +47,9 @@
         dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been
acknowledged from the destination");
         inflight = new CountStatisticImpl("inflight", "The number of messages dispatched
but awaiting acknowledgement");
         consumers = new CountStatisticImpl("consumers", "The number of consumers that that
are subscribing to messages from the destination");
+        consumers.setDoReset(false);
         producers = new CountStatisticImpl("producers", "The number of producers that that
are publishing messages to the destination");
+        producers.setDoReset(false);
         messages = new CountStatisticImpl("messages", "The number of messages that that are
being held by the destination");
         messagesCached = new PollCountStatisticImpl("messagesCached", "The number of messages
that are held in the destination's memory cache");
         processTime = new TimeStatisticImpl("processTime", "information around length of
time messages are held by a destination");
@@ -55,7 +58,7 @@
         addStatistic("dequeues", dequeues);
         addStatistic("inflight", inflight);
         addStatistic("consumers", consumers);
-        addStatistic("prodcuers", producers);
+        addStatistic("producers", producers);
         addStatistic("messages", messages);
         addStatistic("messagesCached", messagesCached);
         addStatistic("processTime", processTime);
@@ -102,11 +105,13 @@
     }
 
     public void reset() {
-        super.reset();
-        enqueues.reset();
-        dequeues.reset();
-        dispatched.reset();
-        inflight.reset();
+        if (this.isDoReset()) {
+            super.reset();
+            enqueues.reset();
+            dequeues.reset();
+            dispatched.reset();
+            inflight.reset();
+        }
     }
 
     public void setEnabled(boolean enabled) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/CountStatisticImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/CountStatisticImpl.java?rev=697937&r1=697936&r2=697937&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/CountStatisticImpl.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/CountStatisticImpl.java
Mon Sep 22 11:35:32 2008
@@ -44,8 +44,10 @@
     }
 
     public void reset() {
-        super.reset();
-        counter.set(0);
+        if (isDoReset()) {
+            super.reset();
+            counter.set(0);
+        }
     }
 
     public long getCount() {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/RangeStatisticImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/RangeStatisticImpl.java?rev=697937&r1=697936&r2=697937&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/RangeStatisticImpl.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/RangeStatisticImpl.java
Mon Sep 22 11:35:32 2008
@@ -32,10 +32,12 @@
     }
 
     public void reset() {
-        super.reset();
-        current = 0;
-        lowWaterMark = 0;
-        highWaterMark = 0;
+        if (isDoReset()) {
+            super.reset();
+            current = 0;
+            lowWaterMark = 0;
+            highWaterMark = 0;
+        }
     }
 
     public long getHighWaterMark() {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java?rev=697937&r1=697936&r2=697937&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java
Mon Sep 22 11:35:32 2008
@@ -32,22 +32,25 @@
     private String description;
     private long startTime;
     private long lastSampleTime;
+    private boolean doReset = true;
 
     public StatisticImpl(String name, String unit, String description) {
         this.name = name;
         this.unit = unit;
         this.description = description;
-        startTime = System.currentTimeMillis();
-        lastSampleTime = startTime;
+        this.startTime = System.currentTimeMillis();
+        this.lastSampleTime = this.startTime;
     }
 
     public synchronized void reset() {
-        startTime = System.currentTimeMillis();
-        lastSampleTime = startTime;
+        if(isDoReset()) {
+            this.startTime = System.currentTimeMillis();
+            this.lastSampleTime = this.startTime;
+        }
     }
 
     protected synchronized void updateSampleTime() {
-        lastSampleTime = System.currentTimeMillis();
+        this.lastSampleTime = System.currentTimeMillis();
     }
 
     public synchronized String toString() {
@@ -60,23 +63,23 @@
     }
 
     public String getName() {
-        return name;
+        return this.name;
     }
 
     public String getUnit() {
-        return unit;
+        return this.unit;
     }
 
     public String getDescription() {
-        return description;
+        return this.description;
     }
 
     public synchronized long getStartTime() {
-        return startTime;
+        return this.startTime;
     }
 
     public synchronized long getLastSampleTime() {
-        return lastSampleTime;
+        return this.lastSampleTime;
     }
 
     /**
@@ -92,18 +95,32 @@
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
     }
+    
+    /**
+     * @return the doReset
+     */
+    public boolean isDoReset() {
+        return this.doReset;
+    }
+
+    /**
+     * @param doReset the doReset to set
+     */
+    public void setDoReset(boolean doReset) {
+        this.doReset = doReset;
+    }
+
 
     protected synchronized void appendFieldDescription(StringBuffer buffer) {
         buffer.append(" unit: ");
-        buffer.append(unit);
+        buffer.append(this.unit);
         buffer.append(" startTime: ");
         // buffer.append(new Date(startTime));
-        buffer.append(startTime);
+        buffer.append(this.startTime);
         buffer.append(" lastSampleTime: ");
         // buffer.append(new Date(lastSampleTime));
-        buffer.append(lastSampleTime);
+        buffer.append(this.lastSampleTime);
         buffer.append(" description: ");
-        buffer.append(description);
+        buffer.append(this.description);
     }
-
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/TimeStatisticImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/TimeStatisticImpl.java?rev=697937&r1=697936&r2=697937&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/TimeStatisticImpl.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/TimeStatisticImpl.java
Mon Sep 22 11:35:32 2008
@@ -43,11 +43,13 @@
     }
 
     public synchronized void reset() {
-        super.reset();
-        count = 0;
-        maxTime = 0;
-        minTime = 0;
-        totalTime = 0;
+        if(isDoReset()) {
+            super.reset();
+            count = 0;
+            maxTime = 0;
+            minTime = 0;
+            totalTime = 0;
+        }
     }
 
     public synchronized long getCount() {



Mime
View raw message