我有一个线程转储,其中有很多线程显示锁定的JDBC4Connection和JDBC4PreparedStatement。为什么有太多线程显示锁定的连接和准备好的语句......
"ajp-bio-14009-exec-606" daemon prio=10 tid=0x00007f625405f800 nid=0x2f88 runnable [0x00007f61cfaf7000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
- locked <0x00000006f1111988> (a com.mysql.jdbc.util.ReadAheadInputStream)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2537)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2990)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2979)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3520)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
- locked <0x00000006f11113e8> (a com.mysql.jdbc.JDBC4Connection)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
- locked <0x00000006d593e3e8> (a com.mysql.jdbc.JDBC4PreparedStatement)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
- locked <0x00000006f11113e8> (a com.mysql.jdbc.JDBC4Connection)
- locked <0x00000006d593e3e8> (a com.mysql.jdbc.JDBC4PreparedStatement)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
- locked <0x00000006d593e3e8> (a com.mysql.jdbc.JDBC4PreparedStatement)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
at com.appnetix.app.util.QueryUtil.update(QueryUtil.java:534)
答案 0 :(得分:0)
这是因为MySql JDBC驱动程序包含许多同步块。您的线程未锁定在同步块上。他们获得必要的锁并等待I / O.