You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cs...@apache.org on 2011/08/30 11:59:02 UTC
svn commit: r1163157 - in
/camel/trunk/camel-core/src/main/java/org/apache/camel: management/
management/mbean/ spi/ spi/management/
Author: cschneider
Date: Tue Aug 30 09:59:02 2011
New Revision: 1163157
URL: http://svn.apache.org/viewvc?rev=1163157&view=rev
Log:
CAMEL-4358 Remove Statistics interface as suggested by Claus and Hadrian
Added:
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/Statistic.java
- copied, changed from r1163153, camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultStatistic.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultStatistic.java
camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCounter.java
camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ManagementStrategy.java
camel/trunk/camel-core/src/main/java/org/apache/camel/spi/management/Statistic.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java?rev=1163157&r1=1163156&r2=1163157&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementStrategy.java Tue Aug 30 09:59:02 2011
@@ -24,6 +24,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.ManagementStatisticsLevel;
import org.apache.camel.management.event.DefaultEventFactory;
+import org.apache.camel.management.mbean.Statistic;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.EventFactory;
import org.apache.camel.spi.EventNotifier;
@@ -31,7 +32,6 @@ import org.apache.camel.spi.ManagementAg
import org.apache.camel.spi.ManagementNamingStrategy;
import org.apache.camel.spi.ManagementObjectStrategy;
import org.apache.camel.spi.ManagementStrategy;
-import org.apache.camel.spi.management.Statistic;
import org.apache.camel.util.ServiceHelper;
/**
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java?rev=1163157&r1=1163156&r2=1163157&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/ManagedManagementStrategy.java Tue Aug 30 09:59:02 2011
@@ -34,7 +34,6 @@ import org.apache.camel.management.mbean
import org.apache.camel.management.mbean.ManagedTracer;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.ManagementAgent;
-import org.apache.camel.spi.management.Statistic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -159,11 +158,6 @@ public class ManagedManagementStrategy e
return true;
}
- @Override
- public Statistic createStatistic(String name, Object owner, Statistic.UpdateMode updateMode) {
- return new DefaultStatistic(updateMode);
- }
-
private ObjectName getObjectName(Object managedObject, Object preferedName) throws Exception {
ObjectName objectName;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCounter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCounter.java?rev=1163157&r1=1163156&r2=1163157&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCounter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCounter.java Tue Aug 30 09:59:02 2011
@@ -20,14 +20,13 @@ import org.apache.camel.spi.ManagementSt
import org.apache.camel.spi.management.ManagedAttribute;
import org.apache.camel.spi.management.ManagedOperation;
import org.apache.camel.spi.management.ManagedResource;
-import org.apache.camel.spi.management.Statistic;
@ManagedResource(description = "Managed Counter")
public abstract class ManagedCounter {
protected Statistic exchangesTotal;
public void init(ManagementStrategy strategy) {
- this.exchangesTotal = strategy.createStatistic("org.apache.camel.exchangesTotal", this, Statistic.UpdateMode.COUNTER);
+ this.exchangesTotal = new Statistic("org.apache.camel.exchangesTotal", this, Statistic.UpdateMode.COUNTER);
}
@ManagedOperation(description = "Reset counters")
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=1163157&r1=1163156&r2=1163157&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 Tue Aug 30 09:59:02 2011
@@ -24,7 +24,6 @@ import org.apache.camel.spi.management.M
import org.apache.camel.spi.management.ManagedOperation;
import org.apache.camel.spi.management.ManagedResource;
import org.apache.camel.spi.management.PerformanceCounter;
-import org.apache.camel.spi.management.Statistic;
import org.apache.camel.util.ExchangeHelper;
@ManagedResource(description = "PerformanceCounter")
@@ -46,22 +45,22 @@ public abstract class ManagedPerformance
public void init(ManagementStrategy strategy) {
super.init(strategy);
- this.exchangesCompleted = strategy.createStatistic("org.apache.camel.exchangesCompleted", this, Statistic.UpdateMode.COUNTER);
- this.exchangesFailed = strategy.createStatistic("org.apache.camel.exchangesFailed", this, Statistic.UpdateMode.COUNTER);
+ this.exchangesCompleted = new Statistic("org.apache.camel.exchangesCompleted", this, Statistic.UpdateMode.COUNTER);
+ this.exchangesFailed = new Statistic("org.apache.camel.exchangesFailed", this, Statistic.UpdateMode.COUNTER);
- this.failuresHandled = strategy.createStatistic("org.apache.camel.failuresHandled", this, Statistic.UpdateMode.COUNTER);
- this.redeliveries = strategy.createStatistic("org.apache.camel.redeliveries", this, Statistic.UpdateMode.COUNTER);
+ this.failuresHandled = new Statistic("org.apache.camel.failuresHandled", this, Statistic.UpdateMode.COUNTER);
+ this.redeliveries = new Statistic("org.apache.camel.redeliveries", this, Statistic.UpdateMode.COUNTER);
- this.minProcessingTime = strategy.createStatistic("org.apache.camel.minimumProcessingTime", this, Statistic.UpdateMode.MINIMUM);
- 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.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);
+ this.minProcessingTime = new Statistic("org.apache.camel.minimumProcessingTime", this, Statistic.UpdateMode.MINIMUM);
+ this.maxProcessingTime = new Statistic("org.apache.camel.maximumProcessingTime", this, Statistic.UpdateMode.MAXIMUM);
+ this.totalProcessingTime = new Statistic("org.apache.camel.totalProcessingTime", this, Statistic.UpdateMode.COUNTER);
+ this.lastProcessingTime = new Statistic("org.apache.camel.lastProcessingTime", this, Statistic.UpdateMode.VALUE);
+ this.meanProcessingTime = new Statistic("org.apache.camel.meanProcessingTime", this, Statistic.UpdateMode.VALUE);
+
+ this.firstExchangeCompletedTimestamp = new Statistic("org.apache.camel.firstExchangeCompletedTimestamp", this, Statistic.UpdateMode.VALUE);
+ this.firstExchangeFailureTimestamp = new Statistic("org.apache.camel.firstExchangeFailureTimestamp", this, Statistic.UpdateMode.VALUE);
+ this.lastExchangeCompletedTimestamp = new Statistic("org.apache.camel.lastExchangeCompletedTimestamp", this, Statistic.UpdateMode.VALUE);
+ this.lastExchangeFailureTimestamp = new Statistic("org.apache.camel.lastExchangeFailureTimestamp", this, Statistic.UpdateMode.VALUE);
}
@Override
Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/Statistic.java (from r1163153, camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultStatistic.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/Statistic.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/Statistic.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultStatistic.java&r1=1163153&r2=1163157&rev=1163157&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultStatistic.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/Statistic.java Tue Aug 30 09:59:02 2011
@@ -14,25 +14,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.management;
-
-import org.apache.camel.spi.management.Statistic;
+package org.apache.camel.management.mbean;
/**
* Default implementation of {@link Statistic}
*/
-public class DefaultStatistic implements Statistic {
+public class Statistic {
+ /**
+ * Statistics mode
+ * <ul>
+ * <li>VALUE - A statistic with this update mode is a simple value that is a straight forward
+ * representation of the updated value.</li>
+ * <li>DIFFERENCE - A statistic with this update mode is a value that represents the difference
+ * between the last two recorded values (or the initial value if two updates have
+ * not been recorded).</li>
+ * <li>COUNTER - A statistic with this update mode interprets updates as increments (positive values)
+ * or decrements (negative values) to the current value.</li>
+ * <li>MAXIMUM - A statistic with this update mode is a value that represents the maximum value
+ * amongst the update values applied to this statistic.</li>
+ * <li>MINIMUM - A statistic with this update mode is a value that represents the minimum value
+ * amongst the update values applied to this statistic.</li>
+ * <ul>
+ */
+ public enum UpdateMode {
+ VALUE, DIFFERENCE, COUNTER, MAXIMUM, MINIMUM
+ }
- private final Statistic.UpdateMode updateMode;
+ private final UpdateMode updateMode;
private long value;
private long updateCount;
/**
* Instantiates a new statistic.
+ * @param owner
+ * @param name
*
* @param updateMode The statistic update mode.
*/
- public DefaultStatistic(Statistic.UpdateMode updateMode) {
+ public Statistic(String name, Object owner, UpdateMode updateMode) {
this.updateMode = updateMode;
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ManagementStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ManagementStrategy.java?rev=1163157&r1=1163156&r2=1163157&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ManagementStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ManagementStrategy.java Tue Aug 30 09:59:02 2011
@@ -22,7 +22,6 @@ import java.util.List;
import org.apache.camel.ManagementStatisticsLevel;
import org.apache.camel.Service;
import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.spi.management.Statistic;
/**
* Strategy for management.
@@ -105,18 +104,6 @@ public interface ManagementStrategy exte
void notify(EventObject event) throws Exception;
/**
- * Creates a statistic; a representation of raw statistical data.
- *
- * @param name The unique name assigned to the statistic usage.
- * @param owner The object whose identity is to be associated with the metric.
- * @param updateMode The update mode to be assigned to the returned statistic.
- * @return the statistic
- *
- * @see Statistic.UpdateMode
- */
- Statistic createStatistic(String name, Object owner, Statistic.UpdateMode updateMode);
-
- /**
* Gets the event notifiers.
*
* @return event notifiers