RainYuY commented on code in PR #16028:
URL: https://github.com/apache/dubbo/pull/16028#discussion_r2712675340


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/AbstractTripleClientStream.java:
##########
@@ -256,43 +307,23 @@ public boolean isReady() {
         if (channel == null) {
             return false;
         }
-        return channel.isWritable();
+        return numSentBytesQueued.get() < ON_READY_THRESHOLD;
     }
 
     /**
      * Called when the channel writability changes.
-     * This method should be invoked by the transport handler when 
channelWritabilityChanged is triggered.
-     * It synchronously notifies the listener (TripleClientCall) which is 
responsible for
-     * asynchronously triggering all necessary callbacks through its executor.
      */
     protected void onWritabilityChanged() {
-        notifyOnReady(false);
+        if (isReady()) {
+            listener.onReady();
+        }
     }
 
     /**
      * Called by InitOnReadyQueueCommand to trigger the initial onReady 
notification.
      */
     public void triggerInitialOnReady() {
-        notifyOnReady(true);
-    }
-
-    /**
-     * notify listener when stream becomes ready
-     *
-     * @param forceNotify if true, always trigger onReady (for initial 
notification);
-     *                    if false, only trigger when state changes from "not 
ready" to "ready"
-     */
-    private synchronized void notifyOnReady(boolean forceNotify) {
-        boolean wasReady = lastReadyState;
-        boolean isNowReady = isReady();
-        lastReadyState = isNowReady;
-
-        // Trigger onReady if:
-        // 1. forceNotify is true (initial notification, spurious is OK), or
-        // 2. state changes from "not ready" to "ready"
-        if (forceNotify || (!wasReady && isNowReady)) {
-            listener.onReady();
-        }
+        listener.onReady();

Review Comment:
   should we check listener would be null?



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