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 2008/09/28 10:35:09 UTC
svn commit: r699782 - in /activemq/camel/trunk/camel-core/src:
main/java/org/apache/camel/management/InstrumentationProcessor.java
test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java
Author: davsclaus
Date: Sun Sep 28 01:35:08 2008
New Revision: 699782
URL: http://svn.apache.org/viewvc?rev=699782&view=rev
Log:
CAMEL-927: JMX route interceptor should handle routes with no output = no processor
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationProcessor.java
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationProcessor.java?rev=699782&r1=699781&r2=699782&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationProcessor.java Sun Sep 28 01:35:08 2008
@@ -51,6 +51,12 @@
}
public boolean process(final Exchange exchange, final AsyncCallback callback) {
+ if (processor == null) {
+ // no processor so nothing to process, so return
+ callback.done(true);
+ return true;
+ }
+
final long startTime = System.nanoTime();
if (processor instanceof AsyncProcessor) {
Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java?rev=699782&r1=699781&r2=699782&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java (original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMSIssue.java Sun Sep 28 01:35:08 2008
@@ -17,39 +17,49 @@
package org.apache.camel.issues;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.interceptor.Tracer;
+import org.apache.camel.model.ProcessorType;
+import org.apache.camel.spi.InterceptStrategy;
/**
* Trying to reproduce CAMEL-927.
*/
public class TwoTimerWithJMSIssue extends ContextTestSupport {
+ private static int counter;
+
@Override
protected void setUp() throws Exception {
- //disableJMX(); in case JMX is the culprint
+ enableJMX(); // the bug was in the JMX so it must be enabled
super.setUp();
}
- public void testTimer() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- // we expect 4 messages to let the timers fire twice
- mock.expectedMinimumMessageCount(4);
+ public void testFromWithNoOutputs() throws Exception {
+ Thread.sleep(500);
- assertMockEndpointsSatisfied();
+ assertTrue("Counter should be 2 or higher", counter >= 2);
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- context.addInterceptStrategy(new Tracer());
-
- from("timer://kickoff_1?period=2000&delay=1").to("mock:result");
+ context.addInterceptStrategy(new MyTracer());
- from("timer://kickoff_2?period=2000&delay=2").to("mock:result");
+ from("timer://kickoff_1?period=250").
+ from("timer://kickoff_2?period=250&delay=10");
}
};
}
+
+ private class MyTracer implements InterceptStrategy {
+ public Processor wrapProcessorInInterceptors(ProcessorType processorType, Processor target)
+ throws Exception {
+ assertNotNull(target);
+ counter++;
+ return target;
+ }
+ }
+
}