Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10874

JettyHttpComponent sets selector threads to 0 when running on 1 CPU

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.18.2
    • Fix Version/s: 2.18.3, 2.19.0
    • Component/s: camel-jetty
    • Labels:
      None
    • Estimated Complexity:
      Novice

      Description

      In JettyHttpComponent, "createHttpClientTransport" method the number of selectors is derived by:

      int selectors = Runtime.getRuntime().availableProcessors() / 2;
      

      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:

      int selector = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
      

      As per the code this is only exercised when maxThreads is not null, otherwise the default constructor is called and selectors are created properly.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                acosentino Andrea Cosentino
                Reporter:
                nhoughto Nick Houghton
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: