public String getCharacterSetMetadata() {
synchronized (getConnectionMutex()) {
return this.characterSetMetadata;
}
}
public void realClose(boolean calledExplicitly) throws SQLException {
MySQLConnection locallyScopedConn = this.connection;
if (locallyScopedConn == null) {
return; // already closed
}
synchronized (locallyScopedConn.getConnectionMutex()) {
...(1)
}
上面是我的代码
理论上不会死锁的啊 可能你的版本和我的差距比较大
用Jconsole检查下死锁把
这个关键是你看看你的代码是什么样的 他说的很明白了 线程1需要obj1的锁 但是被线程2持有了 线程二正好相反