This article gives you a brief summary of three kinds of timeout settings in Java httpclient
In Apache's httpclient package, there are three settings where the setting expires:
/* Timeout to fetch connections from connection pool */connmanagerparams.settimeout (params, 1000); /* Connection Timeout */httpconnectionparams.setconnectiontimeout (params, 2000); /* Request Timeout */httpconnectionparams.setsotimeout (params, 4000);
First, Connectionpooltimeout:
Defines the time-out for removing a connection from a ConnectionManager managed connection pool.
Error will throw connectionpooltimeoutexception
Second, ConnectionTimeout:
Defines the timeout for establishing a connection to the server over a network, and the HttpClient package creates a socket connection to the server through an asynchronous thread, which is the time-out for the socket connection.
An error will be thrown when connecting to an HTTP server or waiting for a valid connection timeout for Httpconnectionmanager management connectiontimeoutexception
Thirdly, Sockettimeout:
This defines the timeout for the socket read data, which is the time to wait for the response data to be fetched from the server.
When the read or receive socket timeout is thrown sockettimeoutexception
Three timeout settings in HttpClient in Java