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: ThreadPoolExecutor configuration
Date Tue, 12 Oct 2010 06:39:43 GMT
Hi

The problem is that you are using 0 as the pool size.
    .threads(0)

If you use 1 or larger it should work

I will fix the issue so you can define 0 as the pool size.


On Mon, Oct 11, 2010 at 7:50 PM, serega <sergejs.melderis@sybase.com> wrote:
>
> Hi.
> Here is the scenario:
> public static void main(String[] args) throws Exception {
>        BasicConfigurator.configure();
>        CamelContext context = new DefaultCamelContext();
>        context.addRoutes(new RouteBuilder() {
>            public void configure() throws Exception {
>                from(new BeanEndpoint())
>                        .threads(4)
>                        .threadName("t1")
>                        .process(new AsyncProcessor() {
>                            public boolean process(Exchange exchange,
> AsyncCallback callback) {
>                                try {
>                                    process(exchange);
>                                } catch (Exception e) {}
>                                callback.done(false);
>                                return false;
>                            }
>                            public void process(Exchange exchange) throws
> Exception {}
>                        })
>                        .threads(0)
>                        .maxPoolSize(2)
>                        .threadName("t2")
>                        .maxQueueSize(0)
>                        .process(new AsyncProcessor() {
>                            public boolean process(Exchange exchange,
> AsyncCallback callback) {
>                                try {
>                                    process(exchange);
>                                } catch (Exception e) {}
>                                callback.done(false);
>                                return false;
>                            }
>
>                            public void process(Exchange exchange) throws
> Exception {}
>                        })
>                        .to(new BeanEndpoint());
>
>            }});
>            context.start();
>        }
>    }
>
>
> In the log I see the following:
>
> 737 [main] DEBUG org.apache.camel.impl.DefaultExecutorServiceStrategy  -
> Created new thread pool for source:
> Threads[[process[com.sybase365.CamelTest2$1$2@49dc423f],
> Threads[[process[com.sybase365.CamelTest2$1$1@1b815bfb], To[bean:null]]]]]
> with name: t1. [poolSize=4, maxPoolSize=6, keepAliveTime=60 SECONDS,
> maxQueueSize=1,
> rejectedExecutionHandler=java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy@63b0bdc8,
> daemon=true] -> java.util.concurrent.ThreadPoolExecutor@12b754b2
> ...
> 907 [main] DEBUG org.apache.camel.impl.DefaultExecutorServiceStrategy  -
> Created new thread pool for source:
> Threads[[process[com.sybase365.CamelTest2$1$1@1b815bfb], To[bean:null]]]
> with name: t2. [poolSize=10, maxPoolSize=20, keepAliveTime=60 SECONDS,
> maxQueueSize=1000,
> rejectedExecutionHandler=java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy@69d95da8,
> daemon=false] -> java.util.concurrent.ThreadPoolExecutor@50d17ec3
>
> The first Executor is configured as specified; the second Executor uses only
> thread name "t2",
> but  why did't it use the rest of configuration parameters?
>
> Thanks,
> Sergey.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ThreadPoolExecutor-configuration-tp3207845p3207845.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message