SimpleHttpConnectionManager being used incorrectly异常处理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yiluoAK_47/article/details/79248463

错误信息

[WARN ] 2012-04-25 16:20:11,728 method:org.apache.commons.httpclient.SimpleHttpConnectionManager.getConnectionWithTimeout(SimpleHttpConnectionManager.java:204)

SimpleHttpConnectionManager being used incorrectly. Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.

在创建httpclient对象的时候,默认使用simpleHttpConnectionManager作为连接管理,而它不适合多线程环境。故修正方法是:自己创建httpclient对象,并指定适合多线程环境的连接管理器。

HttpClient httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页