You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/09/28 11:02:41 UTC

[shardingsphere] branch master updated: Fix finish connection if not exist executionId. (#21245)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new b2c997c5e01 Fix finish connection if not exist executionId. (#21245)
b2c997c5e01 is described below

commit b2c997c5e01024615289a15fae409f7ac69eccda
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Wed Sep 28 19:02:32 2022 +0800

    Fix finish connection if not exist executionId. (#21245)
---
 .../proxy/frontend/netty/FrontendChannelInboundHandler.java           | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
index 7b4fba13dd4..a38a5ea0e4a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
@@ -37,6 +37,8 @@ import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngi
 import org.apache.shardingsphere.proxy.frontend.state.ProxyStateContext;
 import org.apache.shardingsphere.transaction.rule.TransactionRule;
 
+import java.util.Optional;
+
 /**
  * Frontend channel inbound handler.
  */
@@ -100,7 +102,7 @@ public final class FrontendChannelInboundHandler extends ChannelInboundHandlerAd
     private void closeAllResources() {
         ConnectionThreadExecutorGroup.getInstance().unregisterAndAwaitTermination(connectionSession.getConnectionId());
         connectionSession.getBackendConnection().closeAllResources();
-        ExecuteProcessEngine.finishConnection(connectionSession.getExecutionId());
+        Optional.ofNullable(connectionSession.getExecutionId()).ifPresent(ExecuteProcessEngine::finishConnection);
         databaseProtocolFrontendEngine.release(connectionSession);
     }