From da00a68e2c5a628b688eac9634ee611b6cca0c95 Mon Sep 17 00:00:00 2001 From: LUA Date: Wed, 18 Nov 2020 13:04:37 +0800 Subject: [PATCH] fix: service is set to null and connection close is not atomic (#2291) service is set to null earlier than connection close --- .../dble/services/manager/response/ShowBackend.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/actiontech/dble/services/manager/response/ShowBackend.java b/src/main/java/com/actiontech/dble/services/manager/response/ShowBackend.java index 3ab5801e1..d49c85c87 100644 --- a/src/main/java/com/actiontech/dble/services/manager/response/ShowBackend.java +++ b/src/main/java/com/actiontech/dble/services/manager/response/ShowBackend.java @@ -213,13 +213,13 @@ public final class ShowBackend { row.add(c.getCharsetName().getClient().getBytes()); row.add(c.getCharsetName().getCollation().getBytes()); row.add(c.getCharsetName().getResults().getBytes()); - row.add(c.isClosed() ? null : (c.getBackendService().getTxIsolation() + "").getBytes()); - row.add(c.isClosed() ? null : (c.getBackendService().isAutocommit() + "").getBytes()); - row.add(c.isClosed() ? null : StringUtil.encode(c.getBackendService().getStringOfSysVariables(), charset)); - row.add(c.isClosed() ? null : StringUtil.encode(c.getBackendService().getStringOfUsrVariables(), charset)); - row.add(c.isClosed() ? null : StringUtil.encode(c.getBackendService().getXaStatus().toString(), charset)); + row.add(null == c.getBackendService() ? null : (c.getBackendService().getTxIsolation() + "").getBytes()); + row.add(null == c.getBackendService() ? null : (c.getBackendService().isAutocommit() + "").getBytes()); + row.add(null == c.getBackendService() ? null : StringUtil.encode(c.getBackendService().getStringOfSysVariables(), charset)); + row.add(null == c.getBackendService() ? null : StringUtil.encode(c.getBackendService().getStringOfUsrVariables(), charset)); + row.add(null == c.getBackendService() ? null : StringUtil.encode(c.getBackendService().getXaStatus().toString(), charset)); row.add(StringUtil.encode(FormatUtil.formatDate(c.getPoolDestroyedTime()), charset)); - if (c.isClosed()) { + if (null == c.getBackendService()) { row.add(null); } else if (state == PooledConnection.INITIAL) { ResponseHandler handler = c.getBackendService().getResponseHandler();