Unverified 提交 020e51db authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1103 from turbanoff/master

Remove redundant synchronization
......@@ -35,7 +35,7 @@ public class Driver implements java.sql.Driver, JdbcDriverBackwardsCompat {
private static final ThreadLocal<Connection> DEFAULT_CONNECTION =
new ThreadLocal<>();
private static volatile boolean registered;
private static boolean registered;
static {
load();
......
......@@ -33,10 +33,8 @@ class DatabaseCloser extends Thread {
* database has been closed, or after a session has been created.
*/
void reset() {
synchronized (this) {
databaseRef = null;
}
}
@Override
public void run() {
......@@ -53,10 +51,9 @@ class DatabaseCloser extends Thread {
}
}
Database database = null;
synchronized (this) {
if (databaseRef != null) {
database = databaseRef.get();
}
WeakReference<Database> ref = this.databaseRef;
if (ref != null) {
database = ref.get();
}
if (database != null) {
try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论