Author: ningjiang
Date: Tue May 27 20:09:58 2008
New Revision: 660798

URL: http://svn.apache.org/viewvc?rev=660798&view=rev
Log:
Applied William's patch for adding the InstrumentationProcessor for the route

Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java?rev=660798&r1=660797&r2=660798&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
 Tue May 27 20:09:58 2008
@@ -84,13 +84,13 @@
             try {
                 ManagedRoute mr = new ManagedRoute(route);
                 // retrieve the per-route intercept for this route
-                /*InstrumentationProcessor interceptor = 
interceptorMap.get(route.getEndpoint());
+                InstrumentationProcessor interceptor = 
interceptorMap.get(route.getEndpoint());
                 if (interceptor == null) {
                     LOG.warn("Instrumentation processor not found for route 
endpoint "
                              + route.getEndpoint());
                 } else {
                     interceptor.setCounter(mr);
-                }*/
+                }
                 agent.register(mr, getNamingStrategy().getObjectName(mr));
             } catch (JMException e) {
                 LOG.warn("Could not register Route MBean", e);
@@ -135,12 +135,7 @@
 
         routeContext.addInterceptStrategy(new 
InstrumentationInterceptStrategy(counterMap));
 
-        // TODO we need to find other way to instrument the route.
-        // Below codes will wrap the interceptor (route instrumentation 
processor) to
-        // the each processors which are already wrapped by the 
InstrumentationInterceptStrategy,
-        // And the router couter will be increased when the processors process 
the exchange
 
-        /*
         // Add an InstrumentationProcessor at the beginning of each route and
         // set up the interceptorMap for onRoutesAdd() method to register the
         // ManagedRoute MBeans.
@@ -152,13 +147,19 @@
             }
 
             Endpoint endpoint  = routeType.getInputs().get(0).getEndpoint();
+            ProcessorType<?>[] outputs =
+                routeType.getOutputs().toArray(new ProcessorType<?>[0]);
 
+            routeType.clearOutput();
             InstrumentationProcessor processor = new 
InstrumentationProcessor();
-
-            routeType.addInterceptor(processor);
+            routeType.intercept(processor);
+            for (ProcessorType<?> output : outputs) {
+                routeType.addOutput(output);
+            }
 
             interceptorMap.put(endpoint, processor);
-        }*/
+        }
+
     }
 
     public CamelNamingStrategy getNamingStrategy() {

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java?rev=660798&r1=660797&r2=660798&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
 Tue May 27 20:09:58 2008
@@ -71,7 +71,7 @@
         resultEndpoint.assertIsSatisfied();
 
         MBeanServer mbs = iAgent.getMBeanServer();
-        //verifyCounter(mbs, new ObjectName(domainName + ":type=route,*"));
+        verifyCounter(mbs, new ObjectName(domainName + ":type=route,*"));
         verifyCounter(mbs, new ObjectName(domainName + ":type=processor,*"));
 
     }


Reply via email to