java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
出现问题原因:此问题出现原因是并发调用同一个httpclient去请求数据。在上一个post|get请求尚未结束时,又启新的线程再次使用该httpclient请求数据。
解决方法:
client.getConnectionManager().closeIdleConnections(0, TimeUnit.MICROSECONDS);
在上面加上
httpGet/httpPost.abort();
httpClient发送请求提示java.lang.IllegalStateException: Invalid use of BasicClientConnManager
最新推荐文章于 2023-08-03 13:15:00 发布