提交 c6584ac2 authored 作者: Noel Grandin's avatar Noel Grandin

revert some unnecessary synchronization

revert parts of  21da5178 "Issue #255: ConcurrentModificationException
with multiple threads in embedded mode and temporary LOBs"

There is no need to lock all sessions this aggressively, it's just the
system session we have to be careful with.
上级 53439d35
...@@ -76,7 +76,6 @@ public class Engine implements SessionFactory { ...@@ -76,7 +76,6 @@ public class Engine implements SessionFactory {
DATABASES.put(name, database); DATABASES.put(name, database);
} }
} }
synchronized (database) {
if (opened) { if (opened) {
// start the thread when already synchronizing on the database // start the thread when already synchronizing on the database
// otherwise a deadlock can occur when the writer thread // otherwise a deadlock can occur when the writer thread
...@@ -122,7 +121,6 @@ public class Engine implements SessionFactory { ...@@ -122,7 +121,6 @@ public class Engine implements SessionFactory {
} }
return session; return session;
} }
}
/** /**
* Open a database connection with the given connection information. * Open a database connection with the given connection information.
......
...@@ -650,7 +650,8 @@ public class Session extends SessionWithState { ...@@ -650,7 +650,8 @@ public class Session extends SessionWithState {
private void removeTemporaryLobs(boolean onTimeout) { private void removeTemporaryLobs(boolean onTimeout) {
if (SysProperties.CHECK2) { if (SysProperties.CHECK2) {
if (!Thread.holdsLock(this) && !Thread.holdsLock(getDatabase())) { if (this == getDatabase().getLobSession()
&& !Thread.holdsLock(this) && !Thread.holdsLock(getDatabase())) {
throw DbException.throwInternalError(); throw DbException.throwInternalError();
} }
} }
......
...@@ -581,9 +581,7 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -581,9 +581,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
} }
traceSystem.close(); traceSystem.close();
if (embedded != null) { if (embedded != null) {
synchronized (embedded) {
embedded.close(); embedded.close();
}
embedded = null; embedded = null;
} }
if (closeError != null) { if (closeError != null) {
......
...@@ -181,9 +181,7 @@ public class TcpServerThread implements Runnable { ...@@ -181,9 +181,7 @@ public class TcpServerThread implements Runnable {
server.traceError(e); server.traceError(e);
} }
try { try {
synchronized (session) {
session.close(); session.close();
}
server.removeConnection(threadId); server.removeConnection(threadId);
} catch (RuntimeException e) { } catch (RuntimeException e) {
if (closeError == null) { if (closeError == null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论