线程状态TIMED_WAITING,在每次执行时都会增加并保持alive-true

时间:2017-11-16 04:53:40

标签: java hibernate c3p0

我在Oracle DB上使用hibernate 4.1.9,使用了jars hibernate-c3p0-4.1.9.Final.jarhibernate-core-4.1.9.Final.jarc3p0-0.9.1.2.jar

c3p0配置如下......

    <property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</property> <!-- hibernate 4.1.9 -->
    <property name="hibernate.c3p0.acquireIncrement">3</property>
    <property name="hibernate.c3p0.maxIdleTime">3600</property>
    <property name="hibernate.c3p0.minPoolSize">6</property>
    <property name="hibernate.c3p0.maxPoolSize">20</property>
    <property name="hibernate.c3p0.maxStatements">20</property>
    <property name="hibernate.c3p0.idleConnectionTestPeriod">1800</property> <!-- seconds -->
    <property name="hibernate.c3p0.maxConnectionAge">50</property>
    <property name="hibernate.c3p0.maxIdleTimeExcessConnections">300</property>
    <property name="hibernate.c3p0.testConnectionOnCheckin">true</property>
    <property name="hibernate.c3p0.preferredTestQuery">select 1 from dual</property>

    <property name="hibernate.cache.provider_class">org.hibernate.cache.internal.NoCachingRegionFactory</property>

增加线程如下....

(它由一个循环打印......由System.out.println("<br/>" + c++ +". "+ t.getState() + " (" + t.isAlive() + ") : " + t.getName());

...输出

    4066. TIMED_WAITING (true) : com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1
    4067. TIMED_WAITING (true) : Timer-203
    4068. TIMED_WAITING (true) : com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0
    4069. TIMED_WAITING (true) : com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0
    4070. TIMED_WAITING (true) : com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0
    2071. TIMED_WAITING (true) : com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1

这些数千个线程正在增加并保持相同的状态。如何删除它们?

0 个答案:

没有答案