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. vue.js实战——props数据验证(自定义构造器检测)

    Vue.component('my-component',{ props:{ //必须是数字类型 propA:Number, //必须是字符串或数字类型 propB:[String,Number], ...

  2. centos6.5之phpmyadmin安装

    PhpMyAdmin 首先我们看一下百度百科,看一下phpmyadmin是做什么的. phpMyAdmin 是一个以PHP为基础,以Web-Base方式架构在网站主机上的MySQL的数据库管理工具,让 ...

  3. cocos creator入门

    前面的话 Cocos Creator 是一个完整的游戏开发解决方案,包括了 cocos2d-x 引擎的 JavaScript 实现,以及快速开发游戏所需要的各种图形界面工具.Cocos Creator ...

  4. 常见的cmd命令

    1.查看所有端口的使用情况:netstat -ano

  5. ZYNQ原理图中添加RTL设计模块

    前言 已有的RTL模块怎么添加到原理图中? 流程 (1)添加文件到设计中. (2)右键文件添加到block design中. (3)连线即可. 以上.

  6. JS生成随机数进行循环匹配数组

    function RndNum(n) { var rnd = ""; for (var i = 0; i < n; i++) rnd += Math.floor(Math.r ...

  7. 洛谷P4643 [国家集训队]阿狸和桃子的游戏(思维题+贪心)

    思维题,好题 把每条边的边权平分到这条边的两个顶点上,之后就是个sb贪心了 正确性证明: 如果一条边的两个顶点被一个人选了,一整条边的贡献就凑齐了 如果分别被两个人选了,一作差就抵消了,相当于谁都没有 ...

  8. This is very likely to create a memory leak 异常

    原因: 内存分配不够 解决办法:tomcat目录下,修改bin/catalina.sh文件,添加以下语句: JAVA_OPTS="-server -Xms768m -Xmx768m -XX: ...

  9. python3 练手实例8 批量命名图片

    #coding:utf-8 import os import tkinter as tk from tkinter import filedialog root = tk.Tk() root.with ...

  10. java里getter和setter的作用(转载)

    [java]类中使用getter和setter的优势 http://www.importnew.com/9716.html java有三大特性:封装,继承还有多态. 而今天,我来讲一下其中最重要的特性 ...