pirateskipper commented on a change in pull request #6959:
URL: https://github.com/apache/dubbo/pull/6959#discussion_r694419377



##########
File path: 
dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java
##########
@@ -184,10 +191,14 @@ public void send(Object message, boolean sent) throws 
RemotingException {
 
     @Override
     public boolean isClosed() {
-        if (client != null) {
-            return client.isClosed();
-        } else {
+        if (closeState != null) {
+            return closeState;
+        }
+
+        if (client == null) {

Review comment:
       `return client == null ? false : client.isClosed();`

##########
File path: 
dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java
##########
@@ -57,15 +58,21 @@
     /**
      * lazy connect, initial state for connection
      */
-    private final boolean initialState;
+    private final boolean initialConnectState;
+    private final Boolean closeState;
     private volatile ExchangeClient client;
     private AtomicLong warningcount = new AtomicLong(0);
 
     public LazyConnectExchangeClient(URL url, ExchangeHandler requestHandler) {
         // lazy connect, need set send.reconnect = true, to avoid channel bad 
status.
         this.url = url.addParameter(SEND_RECONNECT_KEY, 
Boolean.TRUE.toString());
         this.requestHandler = requestHandler;
-        this.initialState = url.getParameter(LAZY_CONNECT_INITIAL_STATE_KEY, 
DEFAULT_LAZY_CONNECT_INITIAL_STATE);
+        this.initialConnectState = 
url.getParameter(LAZY_CONNECT_INITIAL_STATE_KEY, 
DEFAULT_LAZY_CONNECT_INITIAL_STATE);
+        if (url.hasParameter(LAZY_CLOSE_STATE_KEY)) {

Review comment:
       `this.closeState = null;
   if (url.hasParameter(LAZY_CLOSE_STATE_KEY)) {
      this.closeState = 
Boolean.parseBoolean(url.getParameter(LAZY_CLOSE_STATE_KEY));
   }`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to