You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marco Crivellaro <mc...@optasportsdata.com> on 2011/03/11 15:46:30 UTC

java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

in some circumstances interceptSendToEndpoint in conjunction with
recipientList and parallel processing is running in exception. this seems to
be the case when and http endpoint is sent in the recipient list after
having processed and ftp in the previous exchange

attached test case shows the expection
(java.util.concurrent.RejectedExecutionException)
http://camel.465427.n5.nabble.com/file/n3425179/FirstTest.java
FirstTest.java 

as a side note: if a separated interceptSendToEndpoint is specified for http
the route does not run in exception.

--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3425179.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
I've created a ticket and attached a test to it
https://issues.apache.org/jira/browse/CAMEL-3795

please let me know if you need further details.

--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p4235950.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
Hi Claus, I've seen you closed the ticket and added a unit test. The unit
test uses mock up endpoint which does not show the wrong behaviour.
The test I've attached to the ticket does not make use of custom thread pool
as you've reported:

from("direct:start").recipientList(header(InterceptSendToEndpointException.recipientListHeaderName).tokenize(",")).to("mock:end");

--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p4267160.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 15, 2011 at 6:00 PM, Marco Crivellaro
<mc...@optasportsdata.com> wrote:
> The following sample:
> http://camel.465427.n5.nabble.com/file/n3710309/FirstTest.java
> FirstTest.java
>
> shows the same issue with only 2 messages sent to 2 distinct endpoints.
> if instead of using a single interceptor "(ftp|sftp|ftps|http):.*"
>
> 2 distinct interceptors are defined:
> "(ftp|sftp|ftps):.*" and "(http):.*" the exception is not thrown.
>
> It is not a problem for me to use this workaround although I would like to
> know the reason why this is happening and if I should expect the same issues
> with other types of endpoints.

Can you create a small unit test which reproduces the issue? And
create a JIRA ticket and attach the unit test.
I am traveling at the moment but will look into when I get back.

Bugs have high priority so we usually fix them in the next release.


>
> --
> View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3710309.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
The following sample: 
http://camel.465427.n5.nabble.com/file/n3710309/FirstTest.java
FirstTest.java 

shows the same issue with only 2 messages sent to 2 distinct endpoints.
if instead of using a single interceptor "(ftp|sftp|ftps|http):.*"

2 distinct interceptors are defined:
"(ftp|sftp|ftps):.*" and "(http):.*" the exception is not thrown.

It is not a problem for me to use this workaround although I would like to
know the reason why this is happening and if I should expect the same issues
with other types of endpoints.

--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3710309.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
to make it run in exception you don't even need to run a cycle of with many
messages sent, you just need to define an the interceptor for ftp and http:

interceptSendToEndpoint("(ftp|sftp|ftps|http):.*").process(
  new Processor() {
    public void process(Exchange exchange) throws Exception {
								
    }
  }
);


and send following messages (recipientList)


template.sendBodyAndHeader("direct:start", String.format("Hello Word %1s",
0) , FirstTest.recipientListHeaderName, ftpEp + ","+ httpEp );
template.sendBodyAndHeader("direct:start", String.format("Hello Word %1s",
0) , FirstTest.recipientListHeaderName, httpEp);

(where ftpEp and httpEp are valid endpoints)



--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3709879.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
why isn't the route running in exception if instead of using an intercept
send to endpoint for all protocols I define 2 different inteceptors, 1 for
ftp and 1 for http?

--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3709344.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Marco Crivellaro <mc...@optasportsdata.com>.
That is not an heavy load sample, it runs in exception after the 2nd time it
runs the for cycle...

--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3556257.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: java.util.concurrent.RejectedExecutionException using interceptSendToEndpoint

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

Camel uses an ExecutorService with a set of threads that are used as thread
pool to process incoming requests. In addition there is a backing
blockingQueue of a fixed capacity associated with the pools for requests
that cannot be immediately picked up for processing.

When threads are fully utilized and the work queue is full then this
particular exception is thrown.

Are you running this route under a heavy load? In any case, you can further
configure the camel context thread pool by injecting your own thread pool.
Please check link below.

http://camel.apache.org/threading-model.html
http://camel.apache.org/threading-model.html 

This should help alleviate your issue.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/java-util-concurrent-RejectedExecutionException-using-interceptSendToEndpoint-tp3425179p3426033.html
Sent from the Camel - Users mailing list archive at Nabble.com.