And in your custom thread pool, you need to set the rejection policy
you want to use.

for example the Abort from the JDK
java.util.concurrent.ThreadPoolExecutor.AbortPolicy



On Tue, May 8, 2012 at 4:17 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> On Tue, May 8, 2012 at 4:15 PM, Thomas Johansen <thxm...@gmail.com> wrote:
>> Hi,
>>
>> There's obviously a difference in how the wireTap()-processor handles
>> exceptions in 2.9.0 and 2.9.1/2.9.2.
>> In 2.9.0, when the wireTap() encounters a RejectedExecutionException on its
>> ExecutorService, the exception is swallowed.
>
> Yes of course that was a bug. Exception should never just be swallowed
> and ignored.
>
>
>> In 2.9.1/2.9.2 the exception is propagated to the errorHandler of the route.
>> Is this by intention? Makes upgrading kind of difficult for me...
>>
>> The following test works with 2.9.0 but not 2.9.1/2.9.2:
>>
>>    @Test
>>    public void wireTapWithExecutorService() throws Exception {
>>    CamelContext context = new DefaultCamelContext();
>>    context.addRoutes(new RouteBuilder() {
>> @Override
>> public void configure() throws Exception {
>> from("direct:test").wireTap("mock:test").executorService(createRejectingExecutor());
>> }
>>    });
>>    context.start();
>>    context.createProducerTemplate().requestBody("direct:test", "TESTING");
>>    }
>>
>>    private ExecutorService createRejectingExecutor() {
>>    ExecutorService executorService = new ThreadPoolExecutor(0, 1, 60,
>> TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
>>    executorService.execute(new Runnable() {
>>    @Override
>>    public void run() {
>>    try {
>>    Thread.sleep(Long.MAX_VALUE);
>>    } catch (InterruptedException e) {
>>    }
>>    }
>>    });
>>    return executorService;
>>    }
>>
>> Takk,
>> Thomas
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to