zrlw edited a comment on pull request #8872:
URL: https://github.com/apache/dubbo/pull/8872#issuecomment-924964900


   i debug ReferenceCountExchangeClientTest test_counter_error() as junit test, 
it showed that:
   ```
           client.close();  <== call HeaderExchangeChannel close() !!!
   
           // client has been replaced with lazy client. lazy client is fetched 
from referenceclientmap, and since it's
           // been invoked once, it's close status is false
           Assertions.assertFalse(client.isClosed(), "client status close");
           Assertions.assertFalse(helloServiceInvoker.isAvailable(), "client 
status close");
           destoy(); <== will call HeaderExchangeChannel close(int timeout)
   ```
   HeaderExchangeChannel close() method will be called at the last 
client.close() in test_counter_error(), and the closed variable value should 
keep false in HeaderExchangeChannel close(), then HeaderExchangeChannel 
close(int timeout) will be called at destroy() - the last statement  in 
test_counter_error(). otherwise the status of the invoker will keep available 
because
   the LazyConnectExchangeClient  that was just closed will be recreated at 
replaceWithLazyClient() in ReferenceCountExchangeClient.java  if the variable 
```closed``` of client is true:
   ```
           if (!(client instanceof LazyConnectExchangeClient) || 
client.isClosed()) {
               ... ...
               client = new LazyConnectExchangeClient(lazyUrl, 
client.getExchangeHandler());
           }
   ```
   maybe HeaderExchangeChannel close() codes should like current branch 3.0 
(just revert #7410 ):
   ```
       @Override
       public void close() {
           try {
               // graceful close
               DefaultFuture.closeChannel(channel);
               channel.close();
           } catch (Throwable e) {
               logger.warn(e.getMessage(), e);
           }
       }
   ```


-- 
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