camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Blocking Processor Issue
Date Sat, 01 Sep 2012 07:18:39 GMT
Hi

Camel 2.10 onwards have a org.apache.camel.spi.ShutdownPrepared your
custom processor can implement, and get notification when shutdown is
in progress.


On Fri, Aug 31, 2012 at 5:43 PM, Jorge Davison <jdavisonc@gmail.com> wrote:
> Hi all, currently i trying to create a blocking processor. This is a
> processor that block the threads until a condition is raised. To make this
> processor i'm using a Semaphore that acquire when processed a Exchange and
> a Timer that execute every X second that release this semaphore to let pass
> the blocked threads. This solution work like a charm but the problem
> appears when the Camel context is shutting down. In this moment i need to
> release all blocked threads, for this, i need that Camel call a shutdown
> method.
> To implement this the processor extends ServiceSupport class but i can't
> get it work.
>
> public void process(Exchange exchange) throws Exception {
>     semaphore.acquire();
> }
>
> protected void doStop() throws Exception {
> if (semaphore.hasQueuedThreads()) {
> int queueLength = semaphore.getQueueLength();
> semaphore.release(queueLength);
> }
> }
>
> Any suggestions?
>
>
> --
> Jorge Davison



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message