简体   繁体   English

apache httpclient 3.1对JDK 8的支持

[英]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. 我有一个使用jdk 6构建的Web应用程序,该应用程序使用apache httpclient 3.1对外部系统执行请求。 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. 这些天来,我已经完成了将这个Web应用程序移植到jdk 8的工作。所有的编译工作都可以正常进行,但是发生了一件奇怪的事情:随机地,一些请求花了正常的执行时间加上5000ms。 I'm sure that is the execution of this call that sometimes run for 5 secs: 我确定这是调用的执行,有时会运行5秒钟:

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? apache httpClient 3.1是否与JDK 8不兼容?

The Apache Foundation added all 3.x in their 4.x versions. Apache Foundation在其4.x版本中添加了所有3.x。 And if you check, you will get they have made their 4.x versions as jdk 7 compatible. 如果您进行检查,就会发现他们已经将其4.x版本与jdk 7兼容。 Hopefully they will work on jdk 8 also. 希望他们也会在jdk 8上工作。

In HttpComponents HttpClient 4.0-alpha1 release , they have some notable changes and enhancements. HttpComponents HttpClient 4.0-alpha1 release ,它们具有一些显着的更改和增强。 One of them is performance issue. 其中之一是性能问题。

HttpClient 4.0 is expected to be 10% to 25% faster than HttpClient 3.x codeline. HttpClient 4.0预计比HttpClient 3.x代码行快10%到25%。 Better performance and smaller memory footprint due to a more efficient HTTP transport based on HttpCore. 由于基于HttpCore的HTTP传输效率更高,因此性能更高,内存占用更小。

Java Compatibility Issue: Java兼容性问题:

  1. In 20 May 2011, HttpComponents HttpCore 4.1.1 (GA) is released. 2011年5月20日,发布了HttpComponents HttpCore 4.1.1(GA)。 This release marks the end of support for Java 1.3. 此版本标志着对Java 1.3支持的终止。 As of release 4.2 HttpCore will require Java 1.5 for all its components. 从4.2版开始,HttpCore的所有组件都将需要Java 1.5。

  2. In 12 September 2013, HttpComponents HttpClient 4.3 (GA) released. 2013年9月12日,发布了HttpComponents HttpClient 4.3(GA)。 This is the first stable (GA) release of HttpClient 4.3. 这是HttpClient 4.3的第一个稳定(GA)版本。 They have support for Java 7 try-with-resources for resource management (connection release.) 他们支持Java 7 try-with-resources进行资源管理(连接发布)。

Resource Link: 资源链接:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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