You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/24 01:35:27 UTC

[GitHub] [dubbo] pirateskipper commented on a change in pull request #6959: [Dubbo-6567] fix consumer warning "safe guard client , should not be called ,must have a bug."

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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org