java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.

java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
at org.apache.http.impl.conn.BasicClientConnectionManager.getConnection(BasicClientConnectionManager.java:162)
at org.apache.http.impl.conn.BasicClientConnectionManager$1.getConnection(BasicClientConnectionManager.java:139)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:456)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
at com.glodon.cloudt.rest.client.RestServiceClientSupport.sendRequest(RestServiceClientSupport.java:205)
at com.glodon.cloudt.rest.client.RestServiceClientSupport.get(RestServiceClientSupport.java:145)
at com.glodon.gys.wantai.service.impl.BillDataSync.index(BillDataSync.java:41)
at com.glodon.gys.wantai.config.ApplicationDaemonService$$Lambda$14/269145726.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

=====百度==

org.apache.http.client.HttpClient使用中,报了以下的异常:
Invalid use of SingleClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
此问题出现原因是并发调用同一个httpclient去请求数据。在上一个post|get请求尚未结束时,又启新的线程再次使用该httpclient请求数据。
目前我的解决方法是用synchronized关键字同步httpclient请求数据的操作。但这个解决方案不能解决并发使用同一个httpClient请求数据的需求,本人对httpclient不精通,有更好解决方法的大神,请不吝赐教!
---------------------
作者:滴水成冰-
来源:CSDN
原文:https://blog.csdn.net/zi413293813/article/details/42916097
版权声明:本文为博主原创文章,转载请附上博文链接!

java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.的更多相关文章

  1. java.lang.IllegalStateException: Connection pool shut down

    最近使用HttpClient 4.5 使用 CloseableHttpClient 发起连接后,使用CloseableHttpResponse 接受返回结果,结果就报错了,上网查了下,有位stacko ...

  2. Spring Scheduled定时任务报错 java.lang.IllegalStateException: Encountered invalid @Scheduled method 'xxx': For input string: "2S"

    报错信息如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ding ...

  3. java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method 解决办法

    java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an in ...

  4. Android开发中使用数据库时出现java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.

    最近在开发一个 App 的时候用到了数据库,可是在使用数据库的时候就出现了一些问题,在我查询表中的一些信息时出现了一下问题: Caused by: java.lang.IllegalStateExce ...

  5. [spring cloud] [error] java.lang.IllegalStateException: Only one connection receive subscriber allowed.

    前言 最近在开发api-gateway的时候遇到了一个问题,网上能够找到的解决方案也很少,之后由公司的大佬解决了这个问题.写下这篇文章记录一下解决方案.希望可以帮助到更多的人. 环境 java版本:8 ...

  6. java.lang.IllegalStateException

    java.lang.IllegalStateExceptionorg.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFac ...

  7. myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

    把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...

  8. java.lang.IllegalStateException:Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx...}: java.lang.IllegalSta ...

  9. 执行打的maven jar包时出现“Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes”

    Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for ...

随机推荐

  1. python3 使用ssl安全连接发送邮件

    今天在测试,阿里云服务器发邮件时,发现使用默认的25端口,邮件无法正常发送,查了相关的资料,才知道,大部分的云服务器都会禁用25端口,所以才想到使用ssl 发送. 下面为具体的python3 使用ss ...

  2. 目录树生成工具treer

    安装方法 $ npm install treer -g 生成结构 $ treer Desktop├─.DS_Store├─.localized├─dir2 | ├─file3 | └file4├─di ...

  3. ArrayList循环遍历并删除元素的几种情况

    如下代码,想要循环删除列表中的元素b,该怎么处理? public class ListDemo { public static void main(String[] args) { ArrayList ...

  4. LVS实现负载均衡原理

    负载均衡集群是load  balance 集群的简写.常用的负载均衡开源软件有nginx.lvs.haproxy,商业的硬件负载均衡设备有F5.NetsNetscale.这里主要是学习lvs. === ...

  5. python爬取某站上海租房图片

    前言 对于一个net开发这爬虫真真的以前没有写过.这段时间开始学习python爬虫,今天周末无聊写了一段代码爬取上海租房图片,其实很简短就是利用爬虫的第三方库Requests与BeautifulSou ...

  6. java工程师的成长历程

    2019年2月 这是我站在刚入行的角度,对自己未来的发展做出的初步的规划,以后慢慢调整 一. 初级java工程师 1.熟悉java的基本语法,拥有面向对象的思维,熟悉javaSE的核心类库 2.学习j ...

  7. 常见的概率分布类型(Probability Distribution)

    统计学中最常见的几种概率分布分别是正态分布(normal distribution),t分布(t distribution),F分布(F distribution)和卡方分布(χ2 distribut ...

  8. 哈尔滨工程大学第十四届程序设计竞赛(同步赛)F 小帆帆走迷宫(dp)

    题目描述 小帆帆被困在一个 NxN 的方格矩阵迷宫,每个格子中都有一个整数 A[i][j].小帆帆从迷宫起点(左上角)格子 A[1][1]开始走,每一步可以向右或向下移动,目标是移动到迷宫的出口右下角 ...

  9. ArrayDataProvider数据分页

    模型 public function search($page=10){ $lists = self::find()->orderBy('id DESC')->all(); $dataPr ...

  10. B树和B+树的插入、删除图文详解(good)

    B树和B+树的插入.删除图文详解 1. B树 1. B树的定义 B树也称B-树,它是一颗多路平衡查找树.我们描述一颗B树时需要指定它的阶数,阶数表示了一个结点最多有多少个孩子结点,一般用字母m表示阶数 ...