提交 c50ac069 authored 作者: Andrey Turbanov's avatar Andrey Turbanov

Remove redundant synchronization

上级 a715afa5
......@@ -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,9 +33,7 @@ class DatabaseCloser extends Thread {
* database has been closed, or after a session has been created.
*/
void reset() {
synchronized (this) {
databaseRef = null;
}
databaseRef = null;
}
@Override
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论