2424import io .grpc .netty .shaded .io .netty .channel .epoll .EpollServerSocketChannel ;
2525import io .grpc .netty .shaded .io .netty .channel .nio .NioEventLoopGroup ;
2626import io .grpc .netty .shaded .io .netty .channel .socket .nio .NioServerSocketChannel ;
27+ import java .util .concurrent .ThreadPoolExecutor ;
28+ import java .util .concurrent .TimeUnit ;
2729import org .apache .rocketmq .common .constant .LoggerName ;
2830import org .apache .rocketmq .logging .org .slf4j .Logger ;
2931import org .apache .rocketmq .logging .org .slf4j .LoggerFactory ;
3032import org .apache .rocketmq .proxy .config .ConfigurationManager ;
33+ import org .apache .rocketmq .proxy .config .ProxyConfig ;
3134import org .apache .rocketmq .proxy .grpc .interceptor .ContextInterceptor ;
3235import org .apache .rocketmq .proxy .grpc .interceptor .GlobalExceptionInterceptor ;
3336import org .apache .rocketmq .proxy .grpc .interceptor .HeaderInterceptor ;
34-
35- import java .util .concurrent .ThreadPoolExecutor ;
36- import java .util .concurrent .TimeUnit ;
3737import org .apache .rocketmq .proxy .service .cert .TlsCertificateManager ;
3838
3939public class GrpcServerBuilder {
@@ -52,18 +52,20 @@ public static GrpcServerBuilder newBuilder(ThreadPoolExecutor executor, int port
5252 }
5353
5454 protected GrpcServerBuilder (ThreadPoolExecutor executor , int port , TlsCertificateManager tlsCertificateManager ) {
55+ ProxyConfig config = ConfigurationManager .getProxyConfig ();
5556 this .tlsCertificateManager = tlsCertificateManager ;
56- serverBuilder = NettyServerBuilder .forPort (port );
57+ serverBuilder = NettyServerBuilder .forPort (port )
58+ .maxConcurrentCallsPerConnection (config .getGrpcMaxConcurrentCallsPerConnection ());
5759
5860 serverBuilder .protocolNegotiator (new ProxyAndTlsProtocolNegotiator ());
5961
6062 // build server
61- int bossLoopNum = ConfigurationManager . getProxyConfig () .getGrpcBossLoopNum ();
62- int workerLoopNum = ConfigurationManager . getProxyConfig () .getGrpcWorkerLoopNum ();
63- int maxInboundMessageSize = ConfigurationManager . getProxyConfig () .getGrpcMaxInboundMessageSize ();
64- long idleTimeMills = ConfigurationManager . getProxyConfig () .getGrpcClientIdleTimeMills ();
63+ int bossLoopNum = config .getGrpcBossLoopNum ();
64+ int workerLoopNum = config .getGrpcWorkerLoopNum ();
65+ int maxInboundMessageSize = config .getGrpcMaxInboundMessageSize ();
66+ long idleTimeMills = config .getGrpcClientIdleTimeMills ();
6567
66- if (ConfigurationManager . getProxyConfig () .isEnableGrpcEpoll ()) {
68+ if (config .isEnableGrpcEpoll ()) {
6769 serverBuilder .bossEventLoopGroup (new EpollEventLoopGroup (bossLoopNum ))
6870 .workerEventLoopGroup (new EpollEventLoopGroup (workerLoopNum ))
6971 .channelType (EpollServerSocketChannel .class )
0 commit comments