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 ...
随机推荐
- MySQL中的用户与授权
grant all on *.* to root@'192.168.20.49'; grant select on *.* to root@192.168.20.49 ; -- dba 可以查询 My ...
- CSS中的opacity,不透明度的坑
opacity的用法示例如下 /* 值是0到1之间的数值 */ opacity:0.5 opacity设置在元素上的时候,会出现什么效果? 答曰:如果不设置opacity的话,会显示效果为A(可以理解 ...
- Python基础:数据类型-字符串(7)
1.字符串基本操作 字符串是由字符组成的一串字符序列,字符串是有顺序的,从左到右,索引从0开始,依次递增. Python中字符串类型:str. Python中字符串的三种表示方式: (1)普通字符串: ...
- pc端手機端自適應佈局方案
https://blog.csdn.net/chose_DoIt/article/details/80424341 https://blog.csdn.net/cxz792116/article/de ...
- Shell 简单构建 Node web服务器
.git bash 执行代码生成: ./makeJs.sh 生成文件如下: 访问:http://127.0.0.1:3030/index.html makeJs.sh 代码如下: #create m ...
- table的 noWrap 属性不换行
nowrap是什么意思? HTML中td元素的nowrap属性表示禁止单元格中的文字自动换行. 但使用时要注意的是,td元素noWrap属性的行为与td元素的width属性有关. td元素中nowra ...
- pytest 13 使用自定义标记mark
前言: pytest可以规定那些要跑,那些不跑,跑特定的哪些?比如以下的这个例子: #!/usr/bin/env/python # -*-coding:utf-8-*- import pytest @ ...
- 一、TensorFlow的简介和安装和一些基本概念
1.Tensorflow的简介 就是一个科学计算的库,用于数据流图(张量流,可以理解成一个N维得数组). Tensorflow支持CPU和GPU,内部实现了对于各种目标函数求导的方式. 2.Tenso ...
- 使用Docker+Jenkins自动构建部署
环境 Windows 10 Docker Version 18.06.1-ce-win73 (19507) 运行jenkins 运行jenkins 容器 docker run -d --name ln ...
- 第三节:Windows平台部署Asp.Net Core应用(基于IIS和Windows服务两种模式)
一. 简介 二. 文件系统发布至IIS 三. Web部署发布至IIS 四. FTP发布至IIS 五. Windows服务的形式发布 ! 作 者 : Yaopengfei(姚鹏飞) 博客地址 ...