提交 245ea350 authored 作者: Andrei Tokar's avatar Andrei Tokar

Revert to Command execution at least under a session lock

上级 a7b3ee6e
...@@ -185,7 +185,7 @@ public abstract class Command implements CommandInterface { ...@@ -185,7 +185,7 @@ public abstract class Command implements CommandInterface {
startTimeNanos = 0; startTimeNanos = 0;
long start = 0; long start = 0;
Database database = session.getDatabase(); Database database = session.getDatabase();
Object sync = database.getMvStore() != null ? null : database.isMultiThreaded() ? session : database; Object sync = database.isMultiThreaded() || database.getMvStore() != null ? session : database;
session.waitIfExclusiveModeEnabled(); session.waitIfExclusiveModeEnabled();
boolean callStop = true; boolean callStop = true;
boolean writing = !isReadOnly(); boolean writing = !isReadOnly();
...@@ -201,12 +201,8 @@ public abstract class Command implements CommandInterface { ...@@ -201,12 +201,8 @@ public abstract class Command implements CommandInterface {
database.checkPowerOff(); database.checkPowerOff();
try { try {
ResultInterface result; ResultInterface result;
if (sync != null) { //noinspection SynchronizationOnLocalVariableOrMethodParameter
//noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (sync) {
synchronized (sync) {
result = query(maxrows);
}
} else {
result = query(maxrows); result = query(maxrows);
} }
callStop = !result.isLazy(); callStop = !result.isLazy();
...@@ -250,7 +246,7 @@ public abstract class Command implements CommandInterface { ...@@ -250,7 +246,7 @@ public abstract class Command implements CommandInterface {
public ResultWithGeneratedKeys executeUpdate(Object generatedKeysRequest) { public ResultWithGeneratedKeys executeUpdate(Object generatedKeysRequest) {
long start = 0; long start = 0;
Database database = session.getDatabase(); Database database = session.getDatabase();
Object sync = database.getMvStore() != null ? null : database.isMultiThreaded() ? session : database; Object sync = database.isMultiThreaded() || database.getMvStore() != null ? session : database;
session.waitIfExclusiveModeEnabled(); session.waitIfExclusiveModeEnabled();
boolean callStop = true; boolean callStop = true;
boolean writing = !isReadOnly(); boolean writing = !isReadOnly();
...@@ -267,12 +263,8 @@ public abstract class Command implements CommandInterface { ...@@ -267,12 +263,8 @@ public abstract class Command implements CommandInterface {
database.checkPowerOff(); database.checkPowerOff();
try { try {
int updateCount; int updateCount;
if (sync != null) { //noinspection SynchronizationOnLocalVariableOrMethodParameter
//noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (sync) {
synchronized (sync) {
updateCount = update();
}
} else {
updateCount = update(); updateCount = update();
} }
if (!Boolean.FALSE.equals(generatedKeysRequest)) { if (!Boolean.FALSE.equals(generatedKeysRequest)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论