作者:雷神天在飘雪_804_959 | 来源:互联网 | 2023-09-07 15:58
本文整理了Java中io.grpc.netty.NettyChannelBuilder.eventLoopGroup()
方法的一些代码示例,展示了NettyChannelBuilder.eventLoopGroup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NettyChannelBuilder.eventLoopGroup()
方法的具体详情如下:
包路径:io.grpc.netty.NettyChannelBuilder
类名称:NettyChannelBuilder
方法名:eventLoopGroup
NettyChannelBuilder.eventLoopGroup介绍
暂无
代码示例
代码示例来源:origin: Alluxio/alluxio
channelBuilder.eventLoopGroup(channelKey.mEventLoopGroup.get());
代码示例来源:origin: glowroot/glowroot
.build());
channel = NettyChannelBuilder.forAddress("localhost", javaagentServicePort)
.eventLoopGroup(eventLoopGroup)
.executor(executor)
.negotiationType(NegotiationType.PLAINTEXT)
代码示例来源:origin: glowroot/glowroot
.eventLoopGroup(eventLoopGroup)
.executor(channelExecutor)
代码示例来源:origin: IBM/etcd-java
chanBuilder.eventLoopGroup(internalExecutor).channelType(channelType);
代码示例来源:origin: venus-boot/saluki
private Channel create(GrpcURL subscribeUrl) {
Channel channel = NettyChannelBuilder.forTarget(registryUrl.toJavaURI().toString())//
.nameResolverFactory(new GrpcNameResolverProvider(subscribeUrl))//
.loadBalancerFactory(buildLoadBalanceFactory())//
.sslContext(buildClientSslContext())//
.negotiationType(NegotiationType.TLS)//
.eventLoopGroup(createWorkEventLoopGroup())//
.keepAliveTime(60, TimeUnit.SECONDS)//
.maxHeaderListSize(4 * 1024 * 1024)//
.directExecutor()//
.build();//
return ClientInterceptors.intercept(channel,
Arrays.asList(HeaderClientInterceptor.instance()));
}
代码示例来源:origin: io.vertx/vertx-grpc
@Override
public ManagedChannel build() {
// SSL
if (options.isSsl()) {
SSLHelper helper = new SSLHelper(options, options.getKeyCertOptions(), options.getTrustOptions());
helper.setApplicationProtocols(Collections.singletonList(HttpVersion.HTTP_2));
SslContext ctx = helper.getContext((VertxInternal) vertx);
builder.sslContext(new DelegatingSslContext(ctx) {
@Override
protected void initEngine(SSLEngine engine) {
helper.configureEngine(engine, null);
}
});
}
Transport transport = ((VertxInternal) vertx).transport();
return builder
.eventLoopGroup(context.nettyEventLoop())
.channelType(transport.channelFactory(false).newChannel().getClass()) // Ugly work around / perhaps contribute change to grpc
.executor(command -> {
if (Context.isOnEventLoopThread()) {
context.executeFromIO(event -> command.run());
} else {
command.run();
}
}).build();
}
}
代码示例来源:origin: lalithsuresh/rapid
private Channel getChannel(final Endpoint remote) {
// TODO: allow configuring SSL/TLS
Channel channel;
LOG.debug("Creating channel from {} to {}", address, remote);
if (settings.getUseInProcessTransport()) {
channel = InProcessChannelBuilder
.forName(remote.toString())
.executor(grpcExecutor)
.usePlaintext(true)
.idleTimeout(10, TimeUnit.SECONDS)
.build();
} else {
channel = NettyChannelBuilder
.forAddress(remote.getHostname(), remote.getPort())
.executor(grpcExecutor)
.eventLoopGroup(eventLoopGroup)
.usePlaintext(true)
.idleTimeout(10, TimeUnit.SECONDS)
.withOption(ChannelOption.SO_REUSEADDR, true)
.withOption(ChannelOption.SO_SNDBUF, DEFAULT_BUF_SIZE)
.withOption(ChannelOption.SO_RCVBUF, DEFAULT_BUF_SIZE)
.build();
}
return channel;
}