horizonzy commented on a change in pull request #8126:
URL: https://github.com/apache/dubbo/pull/8126#discussion_r666217486



##########
File path: 
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/Connection.java
##########
@@ -149,14 +155,16 @@ public void onGoaway(Channel channel) {
 
     public void onConnected(Channel channel) {
         this.channel.set(channel);
+        // This indicates that the connection is available.
+        this.connectedFuture.complete(CONNECTED_OBJECT);
         channel.attr(CONNECTION).set(this);
         if (logger.isInfoEnabled()) {
             logger.info(String.format("%s connected ", this));
         }
     }
 
-    public void connectSync() {
-        this.initPromise.awaitUninterruptibly(this.connectTimeout);
+    public void connectSync() throws InterruptedException, ExecutionException, 
TimeoutException {
+        this.connectedFuture.get(this.connectTimeout, TimeUnit.MILLISECONDS);

Review comment:
       Why change the origin modify. Is there some problem when use spin to 
check isAvailabel()?
   If we use future to realize sync mechanism, the connectedFuture is stateful, 
if the connect close and then reconnect, the connectFuture can't gurantee sync 
mechanism.




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