简体   繁体   中英

apache httpclient 3.1 support for JDK 8

I've a web application built using jdk 6 that uses apache httpclient 3.1 to perform requests to external systems. In these days I've done the porting of this web app to jdk 8. All compile and all is working, but a strange thing happens: randomly some requests take the normal time for execution plus 5000ms. I'm sure that is the execution of this call that sometimes run for 5 secs:

long t0 = System.currentTimeMillis()
int statusCode = client.executeMethod(get)
long dt = System.currentTimeMillis() - t0;

Is possible that apache httpClient 3.1 is not compliant with JDK 8?

The Apache Foundation added all 3.x in their 4.x versions. And if you check, you will get they have made their 4.x versions as jdk 7 compatible. Hopefully they will work on jdk 8 also.

In HttpComponents HttpClient 4.0-alpha1 release , they have some notable changes and enhancements. One of them is performance issue.

HttpClient 4.0 is expected to be 10% to 25% faster than HttpClient 3.x codeline. Better performance and smaller memory footprint due to a more efficient HTTP transport based on HttpCore.

Java Compatibility Issue:

  1. In 20 May 2011, HttpComponents HttpCore 4.1.1 (GA) is released. This release marks the end of support for Java 1.3. As of release 4.2 HttpCore will require Java 1.5 for all its components.

  2. In 12 September 2013, HttpComponents HttpClient 4.3 (GA) released. This is the first stable (GA) release of HttpClient 4.3. They have support for Java 7 try-with-resources for resource management (connection release.)

Resource Link:

  1. https://hc.apache.org/news.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM