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

JettyHttpComponent sets selector threads to 0 when running on 1 CPU

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.18.2
    • 2.18.3, 2.19.0
    • camel-jetty
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: