[ 
https://issues.apache.org/jira/browse/CAMEL-10874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15877813#comment-15877813
 ] 

ASF GitHub Bot commented on CAMEL-10874:
----------------------------------------

GitHub user nhoughto opened a pull request:

    https://github.com/apache/camel/pull/1483

    CAMEL-10874: Ensure Jetty client selector count is a minimum of 1.

    As per https://issues.apache.org/jira/browse/CAMEL-10874

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nhoughto/camel defect-CAMEL-10874

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1483.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1483
    
----
commit 7586bfe23b202e1a85ab1e04ec3bae206b595472
Author: Nick Houghton <[email protected]>
Date:   2017-02-22T08:59:00Z

    CAMEL-10874 - Ensure Jetty client selector count is a minimum of 1.

----


> JettyHttpComponent sets selector threads to 0 when running on 1 CPU
> -------------------------------------------------------------------
>
>                 Key: CAMEL-10874
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10874
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jetty
>    Affects Versions: 2.16.5, 2.17.5, 2.18.2
>            Reporter: Nick Houghton
>            Assignee: Andrea Cosentino
>             Fix For: 2.17.6, 2.18.3, 2.19.0
>
>
> In JettyHttpComponent, "createHttpClientTransport" method the number of 
> selectors is derived by:
> {noformat}
> int selectors = Runtime.getRuntime().availableProcessors() / 2;
> {noformat}
> If the number of available processors is 1, divided by 2, cast to int is 0 
> which causes an IllegalArgumentException.
> The safe way to do this is via Math.max, like the Jetty code does:
> {noformat}
> int selector = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
> {noformat}
> As per the code this is only exercised when maxThreads is not null, otherwise 
> the default constructor is called and selectors are created properly.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to