Home  >  Article  >  Database  >  C3P0APPARENTDEADLOCK

C3P0APPARENTDEADLOCK

WBOY
WBOYOriginal
2016-06-07 15:59:102028browse

一,c3p0运行一段时间后报错如下 W 07-26_00:58:27 ThreadPoolAsynchronousRunner.java 608 com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@70929ab6 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending task

一,c3p0运行一段时间后报错如下

W 07-26_00:58:27 ThreadPoolAsynchronousRunner.java 608 com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@70929ab6 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! 
W 07-26_00:58:39 ThreadPoolAsynchronousRunner.java 608 com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@4496b93a -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
二,解决方法如下

1,更新c3p0版本到0.9.2.1 该版本优化了获取connection的规则

2,首先修改c3p0配置参数

<!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements
       属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。
       如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0-->
 <property name="maxStatements" value="0"/>
<!--连接池用完时客户调用getConnection()后等待获取连接的时间,单位:毫秒。超时后会抛出-->
 <!--SQLEXCEPTION,如果设置0,则无限等待。Default:0-->
 <property name="checkoutTimeout" value="100"/>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn