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