fix: service is set to null and connection close is not atomic (#2291)

service is set to null earlier than connection close
This commit is contained in:
LUA
2020-11-18 13:04:37 +08:00
committed by GitHub
parent 490b0e1686
commit da00a68e2c
@@ -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();