From dcff228b4c13bf0fd9f7bb0d52f9c18aaba36b59 Mon Sep 17 00:00:00 2001 From: wenyh1 <2365151147@qq.com> Date: Tue, 31 Oct 2023 18:03:06 +0800 Subject: [PATCH] [inner-2371] fix: sql execution hang problem caused by the inability to respond to the front side due to unprocessed packets. --- .../java/com/actiontech/dble/services/BackendService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/actiontech/dble/services/BackendService.java b/src/main/java/com/actiontech/dble/services/BackendService.java index 0b01ae843f..c973db8269 100644 --- a/src/main/java/com/actiontech/dble/services/BackendService.java +++ b/src/main/java/com/actiontech/dble/services/BackendService.java @@ -131,7 +131,7 @@ public void execute(ServiceTask task, ThreadContext threadContext) { handleDataError(e); } finally { isHandling.set(false); - if (taskQueue.size() > 0) { + if (!taskQueue.isEmpty()) { doHandle(task); } } @@ -232,7 +232,7 @@ protected void handleInnerData(byte[] data) { protected void handleDataError(Exception e) { LOGGER.warn(this.toString() + " handle data error:", e); connection.close("handle data error:" + e.getMessage()); - while (taskQueue.size() > 0) { + while (!taskQueue.isEmpty()) { clearTaskQueue(); readSize.set(0); // clear all data from the client @@ -697,8 +697,8 @@ public void run() { handleDataError(e); } finally { isHandling.set(false); - if (taskQueue.size() > 0) { - doHandle(null); + if (!taskQueue.isEmpty()) { + doHandle(taskQueue.peek()); } } }