This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e4e674  camel-core - Polished
5e4e674 is described below

commit 5e4e674af9e51fb06bd15e7578cf5fd3c9967be8
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Jan 16 21:49:57 2020 +0100

    camel-core - Polished
---
 .../apache/camel/spi/ManagementInterceptStrategy.java   |  4 ++--
 .../management/DefaultInstrumentationProcessor.java     | 17 +++++------------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/ManagementInterceptStrategy.java
 
b/core/camel-api/src/main/java/org/apache/camel/spi/ManagementInterceptStrategy.java
index 3eb119b..b7245f0 100644
--- 
a/core/camel-api/src/main/java/org/apache/camel/spi/ManagementInterceptStrategy.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/ManagementInterceptStrategy.java
@@ -30,9 +30,9 @@ public interface ManagementInterceptStrategy {
 
     interface InstrumentationProcessor<T> extends AsyncProcessor, Ordered {
 
-        T before(Exchange exchange) throws Exception;
+        T before(Exchange exchange);
 
-        void after(Exchange exchange, T data) throws Exception;
+        void after(Exchange exchange, T data);
 
         void setProcessor(Processor processor);
 
diff --git 
a/core/camel-management/src/main/java/org/apache/camel/management/DefaultInstrumentationProcessor.java
 
b/core/camel-management/src/main/java/org/apache/camel/management/DefaultInstrumentationProcessor.java
index 0be34c5..02960af 100644
--- 
a/core/camel-management/src/main/java/org/apache/camel/management/DefaultInstrumentationProcessor.java
+++ 
b/core/camel-management/src/main/java/org/apache/camel/management/DefaultInstrumentationProcessor.java
@@ -17,7 +17,6 @@
 package org.apache.camel.management;
 
 import org.apache.camel.AsyncCallback;
-import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Exchange;
 import org.apache.camel.Ordered;
 import org.apache.camel.Processor;
@@ -45,7 +44,7 @@ public class DefaultInstrumentationProcessor extends 
DelegateAsyncProcessor
     }
 
     public DefaultInstrumentationProcessor(String type) {
-        super((AsyncProcessor) null);
+        super(null);
         this.type = type;
     }
 
@@ -67,20 +66,14 @@ public class DefaultInstrumentationProcessor extends 
DelegateAsyncProcessor
 
     @Override
     public boolean process(final Exchange exchange, final AsyncCallback 
callback) {
-        // only record time if stats is enabled
-        final StopWatch watch = (counter != null && 
counter.isStatisticsEnabled()) ? new StopWatch() : null;
-
-        // mark beginning to process the exchange
-        if (watch != null) {
-            beginTime(exchange);
-        }
+        final StopWatch watch = before(exchange);
 
         return processor.process(exchange, new AsyncCallback() {
             public void done(boolean doneSync) {
                 try {
                     // record end time
                     if (watch != null) {
-                        recordTime(exchange, watch.taken());
+                        after(exchange, watch);
                     }
                 } finally {
                     // and let the original callback know we are done as well
@@ -120,7 +113,7 @@ public class DefaultInstrumentationProcessor extends 
DelegateAsyncProcessor
     }
 
     @Override
-    public StopWatch before(Exchange exchange) throws Exception {
+    public StopWatch before(Exchange exchange) {
         // only record time if stats is enabled
         StopWatch answer = counter != null && counter.isStatisticsEnabled() ? 
new StopWatch() : null;
         if (answer != null) {
@@ -130,7 +123,7 @@ public class DefaultInstrumentationProcessor extends 
DelegateAsyncProcessor
     }
 
     @Override
-    public void after(Exchange exchange, StopWatch watch) throws Exception {
+    public void after(Exchange exchange, StopWatch watch) {
         // record end time
         if (watch != null) {
             recordTime(exchange, watch.taken());

Reply via email to