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