Three types of timeouts for httpclient

Source: Internet
Author: User

HttpClient 3 Timeout Description:

/* Timeout for fetching connections from the connection pool */connmanagerparams.settimeout (params, 1000);/* Connection Timeout */httpconnectionparams.setconnectiontimeout ( params, 2000);/* Request Timeout */httpconnectionparams.setsotimeout (params, 4000);

The first line sets Connectionpooltimeout: This defines the time-out period for removing a connection from the ConnectionManager managed connection pool, set here to 1 seconds.

The second line sets ConnectionTimeout: This defines the time-out for establishing a connection to the server over the network. In the HttpClient package, an asynchronous thread is created to create the socket connection to the server, which is the time-out for the socket, set to 2 seconds.

The third line sets the Sockettimeout: This defines the time-out time for the socket read data, that is, how long it takes for the response data to be fetched from the server, set to 4 seconds.

Three types of timeouts for httpclient

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.