I fixed this issue by setting the option "delay=100" which makes sure the first execution happens after 100ms. With the default, "delay=0", the first execution is skipped some time by the TimerQueue.
Best, Christian On Sat, Sep 8, 2012 at 2:05 PM, Christian Müller < [email protected]> wrote: > Claus, this commit breaks the AggregatorTimerAndTracerTest on CI server > and also my machine. > Could you please have a look at it. > > [1] > https://builds.apache.org/view/A-F/view/Camel/job/Camel.2.10.x.fulltest/32/org.apache.camel$camel-core/testReport/org.apache.camel.processor.aggregator/AggregatorTimerAndTracerTest/testAggregatorTimerAndTracer/ > > Best, > Christian > > > On Mon, Aug 27, 2012 at 11:09 AM, <[email protected]> wrote: > >> Author: davsclaus >> Date: Mon Aug 27 09:09:51 2012 >> New Revision: 1377608 >> >> URL: http://svn.apache.org/viewvc?rev=1377608&view=rev >> Log: >> CAMEL-5542: Timer component. Avoid firing during CamelContext is starting. >> >> Modified: >> >> camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java >> >> Modified: >> camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java >> URL: >> http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java?rev=1377608&r1=1377607&r2=1377608&view=diff >> >> ============================================================================== >> --- >> camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java >> (original) >> +++ >> camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java >> Mon Aug 27 09:09:51 2012 >> @@ -89,8 +89,9 @@ public class TimerConsumer extends Defau >> * Whether the timer task is allow to run or not >> */ >> protected boolean isTaskRunAllowed() { >> - // only allow running the timer task if we can run and are not >> suspended >> - return isRunAllowed() && !isSuspended(); >> + // only allow running the timer task if we can run and are not >> suspended, >> + // and CamelContext must have been fully started >> + return endpoint.getCamelContext().getStatus().isStarted() && >> isRunAllowed() && !isSuspended(); >> } >> >> protected void configureTask(TimerTask task, Timer timer) { >> @@ -132,12 +133,12 @@ public class TimerConsumer extends Defau >> LOG.trace("Timer {} is firing #{} count", >> endpoint.getTimerName(), counter); >> try { >> getProcessor().process(exchange); >> - >> - // log exception if an exception occurred and was not handled >> - if (exchange.getException() != null) { >> - getExceptionHandler().handleException("Error processing >> exchange", exchange, exchange.getException()); >> - } >> } catch (Exception e) { >> + exchange.setException(e); >> + } >> + >> + // handle any thrown exception >> + if (exchange.getException() != null) { >> getExceptionHandler().handleException("Error processing >> exchange", exchange, exchange.getException()); >> } >> } >> >> >> > > > -- > > > --
