camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siegfried.Wirth" <>
Subject Re: Bug in ScheduledPollingConsumer? (Unit-Test added)
Date Mon, 22 Jun 2009 16:50:14 GMT

Wrote a small unit test demonstrating the issue: 


when testing some ftp functionality I found the following issue which may
indicate a bug in ScheduledPollingConsumer:

1) I start a route using FtpConsumer (and thus a ScheduledPollingConsumer)
2) This route encounters an error, because the ftp server is not available
and thus an excpetion is logged.
3) Now I try to stop the route (to do some reconfigurations and later i want
to start it again) and everything fails...

I think there is the following problem in ScheduledPollingConsumer:
- When the run-Methods tries to poll and poll throws an exception, the
consumer 'remembers' this exception as firstExceptionThrown (there is a
variable named so in the polling consumer).
- When later on the route is stopped and therefore the
ScheduledPollingConsumer is stop the method doStop() is invoked. There is
the following code:

doStop() {
    [//call the real implementors to stop]
   if (firstExceptionThrown != null) {
      throw firstExceptionThrown;

So this will throw an exception even if stopping the route works fine.
Therefore an exception is thrown in the context of stopping the route that
occured in quite normal situation - but because it is thrown there, it is
really thrown and leads to failures.

I think every method needs its own variable firstExceptionThrown, to avoid
such cross-throwing-exception.

Siegfried Wirth
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message