You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/09/11 12:35:34 UTC
svn commit: r813766 - in /camel/trunk/camel-core/src:
main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
Author: davsclaus
Date: Fri Sep 11 10:35:33 2009
New Revision: 813766
URL: http://svn.apache.org/viewvc?rev=813766&view=rev
Log:
Renamed some stats to better reflect what you get
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java?rev=813766&r1=813765&r2=813766&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java Fri Sep 11 10:35:33 2009
@@ -33,10 +33,11 @@
private Statistic maxProcessingTime;
private Statistic totalProcessingTime;
private Statistic lastProcessingTime;
- private Statistic firstExchangeCompletedTime;
- private Statistic firstExchangeFailureTime;
- private Statistic lastExchangeCompletedTime;
- private Statistic lastExchangeFailureTime;
+ private Statistic meanProcessingTime;
+ private Statistic firstExchangeCompletedTimestamp;
+ private Statistic firstExchangeFailureTimestamp;
+ private Statistic lastExchangeCompletedTimestamp;
+ private Statistic lastExchangeFailureTimestamp;
private boolean statisticsEnabled = true;
public ManagedPerformanceCounter(ManagementStrategy strategy) {
@@ -47,11 +48,12 @@
this.maxProcessingTime = strategy.createStatistic("org.apache.camel.maximumProcessingTime", this, Statistic.UpdateMode.MAXIMUM);
this.totalProcessingTime = strategy.createStatistic("org.apache.camel.totalProcessingTime", this, Statistic.UpdateMode.COUNTER);
this.lastProcessingTime = strategy.createStatistic("org.apache.camel.lastProcessingTime", this, Statistic.UpdateMode.VALUE);
+ this.meanProcessingTime = strategy.createStatistic("org.apache.camel.meanProcessingTime", this, Statistic.UpdateMode.VALUE);
- this.firstExchangeCompletedTime = strategy.createStatistic("org.apache.camel.firstExchangeCompletedTime", this, Statistic.UpdateMode.VALUE);
- this.firstExchangeFailureTime = strategy.createStatistic("org.apache.camel.firstExchangeFailureTime", this, Statistic.UpdateMode.VALUE);
- this.lastExchangeCompletedTime = strategy.createStatistic("org.apache.camel.lastExchangeCompletedTime", this, Statistic.UpdateMode.VALUE);
- this.lastExchangeFailureTime = strategy.createStatistic("org.apache.camel.lastExchangeFailureTime", this, Statistic.UpdateMode.VALUE);
+ this.firstExchangeCompletedTimestamp = strategy.createStatistic("org.apache.camel.firstExchangeCompletedTimestamp", this, Statistic.UpdateMode.VALUE);
+ this.firstExchangeFailureTimestamp = strategy.createStatistic("org.apache.camel.firstExchangeFailureTimestamp", this, Statistic.UpdateMode.VALUE);
+ this.lastExchangeCompletedTimestamp = strategy.createStatistic("org.apache.camel.lastExchangeCompletedTimestamp", this, Statistic.UpdateMode.VALUE);
+ this.lastExchangeFailureTimestamp = strategy.createStatistic("org.apache.camel.lastExchangeFailureTimestamp", this, Statistic.UpdateMode.VALUE);
}
@Override
@@ -64,10 +66,11 @@
maxProcessingTime.reset();
totalProcessingTime.reset();
lastProcessingTime.reset();
- firstExchangeCompletedTime.reset();
- firstExchangeFailureTime.reset();
- lastExchangeCompletedTime.reset();
- lastExchangeFailureTime.reset();
+ meanProcessingTime.reset();
+ firstExchangeCompletedTimestamp.reset();
+ firstExchangeFailureTimestamp.reset();
+ lastExchangeCompletedTimestamp.reset();
+ lastExchangeFailureTimestamp.reset();
}
@ManagedAttribute(description = "Number of completed exchanges")
@@ -87,8 +90,7 @@
@ManagedAttribute(description = "Mean Processing Time [milliseconds]")
public long getMeanProcessingTime() throws Exception {
- long count = exchangesCompleted.getValue();
- return count > 0 ? totalProcessingTime.getValue() / count : 0;
+ return meanProcessingTime.getValue();
}
@ManagedAttribute(description = "Max Processing Time [milliseconds]")
@@ -107,26 +109,26 @@
}
@ManagedAttribute(description = "Last Exchange Completed Timestamp")
- public Date getLastExchangeCompletedTime() {
- long value = lastExchangeCompletedTime.getValue();
+ public Date getLastExchangeCompletedTimestamp() {
+ long value = lastExchangeCompletedTimestamp.getValue();
return value > 0 ? new Date(value) : null;
}
@ManagedAttribute(description = "First Exchange Completed Timestamp")
- public Date getFirstExchangeCompletedTime() {
- long value = firstExchangeCompletedTime.getValue();
+ public Date getFirstExchangeCompletedTimestamp() {
+ long value = firstExchangeCompletedTimestamp.getValue();
return value > 0 ? new Date(value) : null;
}
@ManagedAttribute(description = "Last Exchange Failed Timestamp")
- public Date getLastExchangeFailureTime() {
- long value = lastExchangeFailureTime.getValue();
+ public Date getLastExchangeFailureTimestamp() {
+ long value = lastExchangeFailureTimestamp.getValue();
return value > 0 ? new Date(value) : null;
}
@ManagedAttribute(description = "First Exchange Failed Timestamp")
- public Date getFirstExchangeFailureTime() {
- long value = firstExchangeFailureTime.getValue();
+ public Date getFirstExchangeFailureTimestamp() {
+ long value = firstExchangeFailureTimestamp.getValue();
return value > 0 ? new Date(value) : null;
}
@@ -155,11 +157,16 @@
lastProcessingTime.updateValue(time);
long now = new Date().getTime();
- if (firstExchangeCompletedTime.getUpdateCount() == 0) {
- firstExchangeCompletedTime.updateValue(now);
+ if (firstExchangeCompletedTimestamp.getUpdateCount() == 0) {
+ firstExchangeCompletedTimestamp.updateValue(now);
}
- lastExchangeCompletedTime.updateValue(now);
+ lastExchangeCompletedTimestamp.updateValue(now);
+
+ // update mean
+ long count = exchangesCompleted.getValue();
+ long mean = count > 0 ? totalProcessingTime.getValue() / count : 0;
+ meanProcessingTime.updateValue(mean);
}
/**
@@ -170,11 +177,11 @@
exchangesFailed.increment();
long now = new Date().getTime();
- if (firstExchangeFailureTime.getUpdateCount() == 0) {
- firstExchangeFailureTime.updateValue(now);
+ if (firstExchangeFailureTimestamp.getUpdateCount() == 0) {
+ firstExchangeFailureTimestamp.updateValue(now);
}
- lastExchangeFailureTime.updateValue(now);
+ lastExchangeFailureTimestamp.updateValue(now);
}
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java?rev=813766&r1=813765&r2=813766&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java Fri Sep 11 10:35:33 2009
@@ -150,10 +150,10 @@
assertTrue(lastProcessingTime >= 0);
assertNotNull("Expected first completion time to be available",
- beanServer.getAttribute(pcob, "FirstExchangeCompletedTime"));
+ beanServer.getAttribute(pcob, "FirstExchangeCompletedTimestamp"));
assertNotNull("Expected last completion time to be available",
- beanServer.getAttribute(pcob, "LastExchangeCompletedTime"));
+ beanServer.getAttribute(pcob, "LastExchangeCompletedTimestamp"));
}
protected RouteBuilder createRouteBuilder() {