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.
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.的更多相关文章
- java.lang.IllegalStateException: Connection pool shut down
最近使用HttpClient 4.5 使用 CloseableHttpClient 发起连接后,使用CloseableHttpResponse 接受返回结果,结果就报错了,上网查了下,有位stacko ...
- 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 ...
- 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 ...
- Android开发中使用数据库时出现java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
最近在开发一个 App 的时候用到了数据库,可是在使用数据库的时候就出现了一些问题,在我查询表中的一些信息时出现了一下问题: Caused by: java.lang.IllegalStateExce ...
- [spring cloud] [error] java.lang.IllegalStateException: Only one connection receive subscriber allowed.
前言 最近在开发api-gateway的时候遇到了一个问题,网上能够找到的解决方案也很少,之后由公司的大佬解决了这个问题.写下这篇文章记录一下解决方案.希望可以帮助到更多的人. 环境 java版本:8 ...
- java.lang.IllegalStateException
java.lang.IllegalStateExceptionorg.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFac ...
- 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 双击启动失败, ...
- 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 ...
- 执行打的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 ...
随机推荐
- Vue实现树形下拉框
Vue自身并没有实现树形下拉框的组件,找了很多资料,最后在Github上找了个插件vue-treeselect,功能还是比较全的,模糊搜索.多选.延迟加载.异步搜索.排序,自定义.Vuex支持等等.这 ...
- Activiti6-FormService(学习笔记)重要
设置流程定义文件: <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns=&qu ...
- c提高第六次课 文件读取
一.基本概念1.文件分类 普通文件:存放在硬盘中的文件 设备文件:屏幕.键盘等特殊文件 文本文件:ASCII文件,每个字节存放一个字符的ASCII码,打开文件看到的是文本信息 二进制文件:数据按其在内 ...
- Python——模块——linecache(对文本行的随机访问)
一.模块的作用 linecache模块允许它获取Python资源文件的任一行. 二.模块函数 (1)linecache. getline(filename, lineno, module_global ...
- Jetson TX1安装pyTorch
https://www.ncnynl.com/archives/201705/1629.html https://blog.csdn.net/qq_36302589/article/details/8 ...
- Nginx HTTP框架提供的请求相关变量
L73 binary_remote_addr 对端二进制IPV4或IPV6 一般用作限制用户请求缓存key connection 递增链接序号 connection_requests 一条TCP链接 ...
- 【kafka】Java连接出现Connection refused: no further information的解决方法
在Linux机器(ip:10.102.16.203)安装完kafka(参考:kafka的安装及使用),在windows上使用Java接口访问服务时(参考:Java实现Kafka的生产者.消费者),报异 ...
- 【题解】Hanoi塔问题
题目描述 有三根柱A,B,C.在柱A上有N块盘片,所有盘片都是大的在下面,小片能放在大片上面.并依次编好序号,现要将A上的N块片移到C柱上,每次只能移动一片,而且在同一根柱子上必须保持上面的盘片比下面 ...
- 洛谷 P4168 [Violet] 蒲公英
历尽千辛万苦终于AC了这道题目... 我们考虑1个区间\([l,r]\), 被其完整包含的块的区间为\([L,R]\) 那么众数的来源? 1.\([l,L)\)或\((R,r]\)中出现的数字 2.\ ...
- [HNOI2012]集合选数(状压DP+构造)
题目要求若出现x,则不能出现2x,3x 所以我们考虑构造一个矩阵 \(1\ 2\ 4 \ 8--\) \(3\ 6\ 12\ 24--\) \(9\ 18\ 36--\) \(--\) 不难发现,对于 ...