fix bug that dble can't start in performance mode (#2268)

* fix hang in performance mode

* fix currentResponseService
This commit is contained in:
Collapsar
2020-11-11 14:00:28 +08:00
committed by yanhuqing
parent 0c1ceec54c
commit 32224cd738
2 changed files with 29 additions and 16 deletions

View File

@@ -238,20 +238,29 @@ public class MySQLBackAuthService extends AuthService {
@Override
public void taskToTotalQueue(ServiceTask task) {
Executor executor = DbleServer.getInstance().getBackendBusinessExecutor();
if (isHandling.compareAndSet(false, true)) {
executor.execute(() -> {
try {
handleInnerData();
} catch (Exception e) {
handleDataError(e);
} finally {
isHandling.set(false);
if (taskQueue.size() > 0) {
taskToTotalQueue(null);
}
}
});
if (SystemConfig.getInstance().getUsePerformanceMode() == 1) {
if (isHandling.compareAndSet(false, true)) {
DbleServer.getInstance().getConcurrentBackHandlerQueue().offer(task);
}
} else {
Executor executor = DbleServer.getInstance().getBackendBusinessExecutor();
if (isHandling.compareAndSet(false, true)) {
executor.execute(this::consumerInternalData);
}
}
}
@Override
public void consumerInternalData() {
try {
handleInnerData();
} catch (Exception e) {
handleDataError(e);
} finally {
isHandling.set(false);
if (taskQueue.size() > 0) {
taskToTotalQueue(null);
}
}
}

View File

@@ -25,13 +25,17 @@ public class MySQLCurrentResponseService extends MySQLResponseService {
}
}
@Override
public void consumerInternalData() {
try {
super.handleInnerData();
handleInnerData();
} catch (Exception e) {
handleDataError(e);
} finally {
isHandling.set(false);
if (taskQueue.size() > 0) {
taskToTotalQueue(null);
}
}
}
}