- 浏览: 33654 次
- 性别:
- 来自: 沈阳
最新评论
怀疑 c3p0多次连接数据库失败后,会阻塞休眠
测试热源提出一个非必现的bug,说断开数据库后,再连上,部分数据会永远都不被处理入库。
找到原因后,完善了保证数据一致性的逻辑。但是为神马是非必现呢?
自己折腾了几次,基本都重现了,但是每次不被处理的文件并不多。在数据库连不上的很长一段时间里,居然只有几个文件发生了问题,是不符合逻辑的。
继续深入分析,查看了断开数据库时日志,发现里面会有休眠字样的内容。据此得到以下怀疑:
1.首先,c3p0默认超时可能很长,如果超时之前,数据库重新连上,可能会避免数据永远不被处理的情况。
2.c3p0超时报错多次后,会休眠,即阻塞正在访问数据库的线程。这样导致永远不被处理的数据不如预期的多。
报错日志内容如下:
(60029 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange.
v2.resourcepool.BasicResourcePool$AcquireTask@35a8d460 (in deadlocked PoolThread) failed to complete in maximum time 600
00ms. Trying interrupt().
(66815 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange.
v2.resourcepool.BasicResourcePool$AcquireTask@5f0f0625 (in deadlocked PoolThread) failed to complete in maximum time 600
00ms. Trying interrupt().
(66815 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange.
v2.resourcepool.BasicResourcePool$AcquireTask@535c97e4 (in deadlocked PoolThread) failed to complete in maximum time 600
00ms. Trying interrupt().
(67205 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN : com.mchange.v2.resourcepool.BasicRes
ourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while performi
ng an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(67221 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN : com.mchange.v2.resourcepool.BasicRes
ourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while performi
ng an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(67221 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN : com.mchange.v2.resourcepool.BasicRes
ourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while performi
ng an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(660069 ms) [Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@74bfed5a] WARN : com.mchange.v2.resour
cepool.BasicResourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3823bdd1 -- Acquisition Attempt
Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the
maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)
(660084 ms) [Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@74bfed5a] WARN : com.mchange.v2.resour
cepool.BasicResourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@63f8247d -- Acquisition Attempt
Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the
maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)
(727258 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@10a33ce2 -- Acquisition Attempt Failed!!! Cle
aring pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number
of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(727305 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4cf221f6 -- Acquisition Attempt Failed!!! Cle
aring pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number
of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(737835 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#run : com.mchange.v2.async.ThreadPoolAsyn
chronousRunner$DeadlockDetector@5d469658 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks
!
(737835 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#run : com.mchange.v2.async.ThreadPoolAsyn
chronousRunner$DeadlockDetector@5d469658 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@41e3a0ec (com.mchange.v2.async.ThreadPoolAsync
hronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@475a07bf (com.mchange.v2.async.ThreadPoolAsync
hronousRunner$PoolThread-#2)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@67b2b131 (com.mchange.v2.async.ThreadPoolAsync
hronousRunner$PoolThread-#1)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@48f3d27
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@57f7cdc7
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:189)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:844)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C
3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:189)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:844)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C
3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:189)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:844)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C
3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(797864 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange
.v2.resourcepool.BasicResourcePool$AcquireTask@41e3a0ec (in deadlocked PoolThread) failed to complete in maximum time 60
000ms. Trying interrupt().
(797864 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange
.v2.resourcepool.BasicResourcePool$AcquireTask@475a07bf (in deadlocked PoolThread) failed to complete in maximum time 60
000ms. Trying interrupt().
(797864 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange
.v2.resourcepool.BasicResourcePool$AcquireTask@67b2b131 (in deadlocked PoolThread) failed to complete in maximum time 60
000ms. Trying interrupt().
(814431 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while perform
ing an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(814462 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while perform
ing an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(814478 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while perform
ing an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
找到原因后,完善了保证数据一致性的逻辑。但是为神马是非必现呢?
自己折腾了几次,基本都重现了,但是每次不被处理的文件并不多。在数据库连不上的很长一段时间里,居然只有几个文件发生了问题,是不符合逻辑的。
继续深入分析,查看了断开数据库时日志,发现里面会有休眠字样的内容。据此得到以下怀疑:
1.首先,c3p0默认超时可能很长,如果超时之前,数据库重新连上,可能会避免数据永远不被处理的情况。
2.c3p0超时报错多次后,会休眠,即阻塞正在访问数据库的线程。这样导致永远不被处理的数据不如预期的多。
报错日志内容如下:
(60029 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange.
v2.resourcepool.BasicResourcePool$AcquireTask@35a8d460 (in deadlocked PoolThread) failed to complete in maximum time 600
00ms. Trying interrupt().
(66815 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange.
v2.resourcepool.BasicResourcePool$AcquireTask@5f0f0625 (in deadlocked PoolThread) failed to complete in maximum time 600
00ms. Trying interrupt().
(66815 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange.
v2.resourcepool.BasicResourcePool$AcquireTask@535c97e4 (in deadlocked PoolThread) failed to complete in maximum time 600
00ms. Trying interrupt().
(67205 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN : com.mchange.v2.resourcepool.BasicRes
ourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while performi
ng an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(67221 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN : com.mchange.v2.resourcepool.BasicRes
ourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while performi
ng an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(67221 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN : com.mchange.v2.resourcepool.BasicRes
ourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while performi
ng an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(660069 ms) [Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@74bfed5a] WARN : com.mchange.v2.resour
cepool.BasicResourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3823bdd1 -- Acquisition Attempt
Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the
maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)
(660084 ms) [Task-Thread-for-com.mchange.v2.async.ThreadPerTaskAsynchronousRunner@74bfed5a] WARN : com.mchange.v2.resour
cepool.BasicResourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@63f8247d -- Acquisition Attempt
Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the
maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)
(727258 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@10a33ce2 -- Acquisition Attempt Failed!!! Cle
aring pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number
of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(727305 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4cf221f6 -- Acquisition Attempt Failed!!! Cle
aring pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number
of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:
171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0Po
oledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(737835 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#run : com.mchange.v2.async.ThreadPoolAsyn
chronousRunner$DeadlockDetector@5d469658 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks
!
(737835 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#run : com.mchange.v2.async.ThreadPoolAsyn
chronousRunner$DeadlockDetector@5d469658 -- APPARENT DEADLOCK!!! Complete Status:
Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@41e3a0ec (com.mchange.v2.async.ThreadPoolAsync
hronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@475a07bf (com.mchange.v2.async.ThreadPoolAsync
hronousRunner$PoolThread-#2)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@67b2b131 (com.mchange.v2.async.ThreadPoolAsync
hronousRunner$PoolThread-#1)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@48f3d27
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@57f7cdc7
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:189)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:844)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C
3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:189)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:844)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C
3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.net.PlainSocketImpl.socketConnect(Native Method)
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
java.net.Socket.connect(Socket.java:529)
java.net.Socket.connect(Socket.java:478)
java.net.Socket.<init>(Socket.java:375)
java.net.Socket.<init>(Socket.java:189)
oracle.net.nt.TcpNTAdapter.connect(Unknown Source)
oracle.net.nt.ConnOption.connect(Unknown Source)
oracle.net.nt.ConnStrategy.execute(Unknown Source)
oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
oracle.net.ns.NSProtocol.connect(Unknown Source)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:844)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:182)
com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.
java:171)
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C
3P0PooledConnectionPool.java:137)
com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(797864 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange
.v2.resourcepool.BasicResourcePool$AcquireTask@41e3a0ec (in deadlocked PoolThread) failed to complete in maximum time 60
000ms. Trying interrupt().
(797864 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange
.v2.resourcepool.BasicResourcePool$AcquireTask@475a07bf (in deadlocked PoolThread) failed to complete in maximum time 60
000ms. Trying interrupt().
(797864 ms) [Timer-1] WARN : com.mchange.v2.async.ThreadPoolAsynchronousRunner#processReplacedThreads : Task com.mchange
.v2.resourcepool.BasicResourcePool$AcquireTask@67b2b131 (in deadlocked PoolThread) failed to complete in maximum time 60
000ms. Trying interrupt().
(814431 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while perform
ing an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(814462 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while perform
ing an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
(814478 ms) [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN : com.mchange.v2.resourcepool.BasicRe
sourcePool#run : com.mchange.v2.resourcepool.BasicResourcePool@20873723 -- Thread unexpectedly interrupted while perform
ing an acquisition attempt.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
相关推荐
1. **连接初始化**:当应用程序启动时,C3P0会根据配置参数预先创建一定数量的数据库连接,放入连接池。 2. **连接获取**:当需要访问数据库时,应用程序从连接池中借用一个连接,而不是直接创建新的连接。 3. **...
jdbc使用c3p0连接池连接数据库,支持配置多个数据源,有相关的查询测试。
C3P0数据库连接池和jar包,因为jdbc没有保持连接的能力,一旦超过一定时间没有使用(大约几百毫秒),连接就会被自动释放掉。而每次新建连接都需要140毫秒左右的时间,所以耗费时间比较多。若使用C3P0连接池来池化...
C3P0连接池是Java应用中常用的数据库连接池组件,它可以帮助我们高效、稳定地管理数据库连接,提高系统性能并降低资源消耗。本实例将详细介绍如何使用C3P0连接池来连接数据库,以及所需的配置和使用步骤。 首先,...
总结一下,C3P0连接数据库涉及到创建数据源配置、设置数据库连接参数、获取和释放连接。而通过JNDI,我们可以将数据源注册到应用服务器,使得应用可以通过统一的名称查找和使用数据源,增强了系统的可移植性和可管理...
C3P0是一个开源的Java数据库连接池,它实现了数据源和JNDI绑定,支持JDBC3规范和JDBC2的标准扩展。在Java应用程序中,数据库连接池扮演着非常重要的角色,它能够有效地管理数据库连接,提高系统性能,减少数据库资源...
**c3p0数据库连接池案例** 在Java开发中,数据库连接池是管理数据库连接的重要工具,它能够有效地提高数据库操作的效率并节省系统资源。C3P0是一款开源的数据库连接池组件,由Maurice Priess创建,被广泛应用于各种...
C3P0是一个开放源代码的JDBC连接池,Hibernate的发行包中默认使用此连接池。据说性能最好。 C3p0连接池连接数据库教程+JavaDemoo Demo包括两个,一个代码配置方法,一个是XML配置方法
C3P0连接池是一种广泛使用的数据库连接池组件,它为Java应用程序提供了高效、自动管理的数据库连接。在Java开发中,使用连接池可以显著提高性能,减少数据库资源的浪费,因为连接池允许复用已经建立的数据库连接,而...
**c3p0数据库连接池详解** c3p0是一个开源的JDBC连接池,它实现了数据源和JNDI绑定,支持JDBC3规范和JDBC2的标准扩展。c3p0的主要功能是管理数据库连接,通过复用已存在的连接来提高数据库访问效率,减少系统资源...
**c3p0数据库连接池**是Java应用中广泛使用的第三方数据库连接管理工具,它能够有效地管理和优化数据库连接,提高应用程序的性能和效率。c3p0库通过提供连接池功能,使得数据库连接可以被多个并发请求共享,避免了...
c3p0的主要功能包括连接池的创建、维护以及自动回收资源,使得多个并发请求可以共享数据库连接,减少频繁创建和关闭连接带来的开销。 一、c3p0简介 c3p0是一个完全开源的JDBC连接池,由Miquel Arroyo开发,遵循LGPL...
C3P0用于连接数据库
java语言连接Mysql数据库。通过Eclipse集成开发工具,编写java类文件,实现JDBC连接。 通过c3p0连接数据库的三种方法,包括xml文件、properties文件。
2. **自动检测与恢复**:C3P0可以定期检查数据库连接的有效性,发现无效连接后会尝试自动恢复,确保系统稳定运行。 3. **连接池配置**:通过配置文件,开发者可以自定义连接池的大小、超时时间、验证查询等参数,以...
本篇文章将深入探讨两种流行的数据库连接池——c3p0和HikariCP,以及它们在数据库操作中的应用。 c3p0是较早出现的开源数据库连接池实现,它提供了一个灵活且功能丰富的解决方案。c3p0的核心特性包括: 1. **连接...
c3p0支持多种方式来确保数据库连接的有效性,并能够在连接失效时尝试重新建立连接。这种机制对于提高应用程序的健壮性和用户体验非常重要,特别是在网络环境不稳定或数据库服务器偶尔出现故障的情况下。 1. **测试...