finefuture commented on code in PR #14077:
URL: https://github.com/apache/dubbo/pull/14077#discussion_r1602825229


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java:
##########
@@ -204,21 +188,27 @@ private void configurerHttp2Handlers(URL url, 
List<ChannelHandler> handlers) {
         handlers.add(new ChannelHandlerPretender(new TripleTailHandler()));
     }
 
-    private Http2FrameCodec buildHttp2FrameCodec(Configuration config, 
ApplicationModel applicationModel) {
+    private Http2FrameCodec buildHttp2FrameCodec(URL url) {
+        TripleConfig tripleConfig = getTripleConfig(url);
         return TripleHttp2FrameCodecBuilder.forServer()
-                .customizeConnection((connection) -> connection
-                        .remote()
-                        .flowController(new 
TriHttp2RemoteFlowController(connection, applicationModel)))
+                .customizeConnection((connection) ->
+                        connection.remote().flowController(new 
TriHttp2RemoteFlowController(connection, tripleConfig)))
                 .gracefulShutdownTimeoutMillis(10000)
                 .initialSettings(new Http2Settings()
-                        .headerTableSize(
-                                
config.getInt(H2_SETTINGS_HEADER_TABLE_SIZE_KEY, 
DEFAULT_SETTING_HEADER_LIST_SIZE))
-                        
.maxConcurrentStreams(config.getInt(H2_SETTINGS_MAX_CONCURRENT_STREAMS_KEY, 
Integer.MAX_VALUE))
-                        
.initialWindowSize(config.getInt(H2_SETTINGS_INITIAL_WINDOW_SIZE_KEY, 
DEFAULT_WINDOW_INIT_SIZE))
-                        
.maxFrameSize(config.getInt(H2_SETTINGS_MAX_FRAME_SIZE_KEY, 
DEFAULT_MAX_FRAME_SIZE))
-                        .maxHeaderListSize(
-                                
config.getInt(H2_SETTINGS_MAX_HEADER_LIST_SIZE_KEY, 
DEFAULT_MAX_HEADER_LIST_SIZE)))
+                        .headerTableSize(tripleConfig.getHeaderTableSize())
+                        
.maxConcurrentStreams(tripleConfig.getMaxConcurrentStreams())
+                        .initialWindowSize(tripleConfig.getInitialWindowSize())
+                        .maxFrameSize(tripleConfig.getMaxFrameSize())
+                        
.maxHeaderListSize(tripleConfig.getMaxHeaderListSize()))
                 .frameLogger(SERVER_LOGGER)
                 .build();
     }
+
+    private TripleConfig getTripleConfig(URL url) {
+        return url.getOrDefaultApplicationModel()
+                .getApplicationConfigManager()
+                .getProtocol(url.getProtocol())
+                .flatMap(protocolConfig -> 
Optional.of(protocolConfig.getTriple()))

Review Comment:
   The getProtocol method will return an Optional and the getTriple method 
cannot be called directly.



-- 
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-unsubscr...@dubbo.apache.org

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


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

Reply via email to