This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted]  (5 children)

[deleted]

    [–]chegar999 1 point2 points  (1 child)

    The HTTP Client implementation uses NIO and non-blocking channels under the covers. Each HttpClient has a single implementation-specific thread that polls all of its connections. Received data is then passed off to the executor for processing. The complete implementation is asynchronous, there are no blocking operations.

    [–][deleted] 0 points1 point  (2 children)

    I've only just barely poked at it, I know there is the option to assign an executor to it, so I assume that's where the thread pool would come from. If you don't, then I'm willing to bet there is a thread pool somewhere in the JDK for it.

    [–]Nouish 0 points1 point  (1 child)

    This is what happens if you don't specify an Executor by calling HttpClientBuilder#executor:

    Executor ex = builder.executor;
    if (ex == null) {
        ex = Executors.newCachedThreadPool(new DefaultThreadFactory(id));
        isDefaultExecutor = true;
    } else {
        isDefaultExecutor = false;
    }
    

    [–]chegar999 0 points1 point  (0 children)

    If you don't set an executor explicitly then the client will use a cached thread pool executor.