1
我使用HIBERNATE和SQL Server構建服務器。當我使用c3p0連接池並進行負載測試時,我得到java中的鎖(在c3p0中)。Hibernate + c3p0 + SQL Server
在線程轉儲我看到:
at java.lang.Object.wait(Object.java:-1)
at java.lang.Object.wait(Object.java:485)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:552)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkoutStatement(GooGooStatementCache.java:168)
at com.mchange.v2.c3p0.impl.NewPooledConnection.checkoutStatement(NewPooledConnection.java:234)
- locked <0x124d> (a com.mchange.v2.c3p0.impl.NewPooledConnection)
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:199)
- locked <0x124e> (a com.mchange.v2.c3p0.impl.NewProxyConnection)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
...
或
at java.lang.Object.wait(Object.java:-1)
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1315)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:78)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
和一段時間的所有線程都被鎖定了。
但如果我使用內部休眠連接池 - 一切ok。我沒有看到任何鎖。但我不能使用內部hibernate連接池,因爲它不適用於生產(來自Hibernate文檔)。
有人可以幫助我,請。
謝謝。我更改DBCP上的c3p0,現在都看得更好。 –