热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

io.grpc.netty.NettyChannelBuilder.eventLoopGroup()方法的使用及代码示例

本文整理了Java中io.grpc.netty.NettyChannelBuilder.eventLoopGroup()方法的一些代码示例,展示了Netty

本文整理了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;
}

推荐阅读
author-avatar
雷神天在飘雪_804_959
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有