本文整理汇总了Java中io.netty.channel.epoll.EpollDomainSocketChannel类的典型用法代码示例。如果您正苦于以下问题:Java EpollDomainSocketChannel类的具体用法?Java EpollDomainSocketChannel怎么用?Java EpollDomainSocketChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EpollDomainSocketChannel类属于io.netty.channel.epoll包,在下文中一共展示了EpollDomainSocketChannel类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: epollGroup
import io.netty.channel.epoll.EpollDomainSocketChannel; //导入依赖的package包/类
public EventLoopGroup epollGroup() {
EventLoopGroup epollEventLoopGroup = new EpollEventLoopGroup(0, new DefaultThreadFactory(threadPrefix));
ChannelFactory<EpollDomainSocketChannel> factory = new ChannelFactory<EpollDomainSocketChannel>() {
@Override
public EpollDomainSocketChannel newChannel() {
return configure(new EpollDomainSocketChannel());
}
};
bootstrap.group(epollEventLoopGroup).channelFactory(factory).handler(new ChannelInitializer<UnixChannel>() {
@Override
protected void initChannel(final UnixChannel channel) throws Exception {
channel.pipeline().addLast(new HttpClientCodec());
}
});
return epollEventLoopGroup;
}
开发者ID:docker-java,项目名称:docker-java,代码行数:19,代码来源:NettyDockerCmdExecFactory.java
示例2: forDescriptor
import io.netty.channel.epoll.EpollDomainSocketChannel; //导入依赖的package包/类
@Override
public ManagedChannel forDescriptor(ApiServiceDescriptor apiServiceDescriptor) {
SocketAddress address = SocketAddressFactory.createFrom(apiServiceDescriptor.getUrl());
return NettyChannelBuilder.forAddress(address)
.channelType(address instanceof DomainSocketAddress
? EpollDomainSocketChannel.class : EpollSocketChannel.class)
.eventLoopGroup(new EpollEventLoopGroup())
.usePlaintext(true)
// Set the message size to max value here. The actual size is governed by the
// buffer size in the layers above.
.maxInboundMessageSize(Integer.MAX_VALUE)
.build();
}
开发者ID:apache,项目名称:beam,代码行数:14,代码来源:ManagedChannelFactory.java
示例3: domainSocketChannelClass
import io.netty.channel.epoll.EpollDomainSocketChannel; //导入依赖的package包/类
@Override
public Class<? extends Channel> domainSocketChannelClass() {
checkForEpollLibrary();
return EpollDomainSocketChannel.class;
}
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:7,代码来源:EpollProvider.java
示例4: newNettyClientChannel
import io.netty.channel.epoll.EpollDomainSocketChannel; //导入依赖的package包/类
private static NettyChannelBuilder newNettyClientChannel(Transport transport,
SocketAddress address, boolean tls, boolean testca, int flowControlWindow,
boolean useDefaultCiphers) throws IOException {
NettyChannelBuilder builder =
NettyChannelBuilder.forAddress(address).flowControlWindow(flowControlWindow);
if (tls) {
builder.negotiationType(NegotiationType.TLS);
SslContext sslContext = null;
if (testca) {
File cert = TestUtils.loadCert("ca.pem");
SslContextBuilder sslContextBuilder = GrpcSslContexts.forClient().trustManager(cert);
if (transport == Transport.NETTY_NIO) {
sslContextBuilder = GrpcSslContexts.configure(sslContextBuilder, SslProvider.JDK);
} else {
// Native transport with OpenSSL
sslContextBuilder = GrpcSslContexts.configure(sslContextBuilder, SslProvider.OPENSSL);
}
if (useDefaultCiphers) {
sslContextBuilder.ciphers(null);
}
sslContext = sslContextBuilder.build();
}
builder.sslContext(sslContext);
} else {
builder.negotiationType(NegotiationType.PLAINTEXT);
}
DefaultThreadFactory tf = new DefaultThreadFactory("client-elg-", true /*daemon */);
switch (transport) {
case NETTY_NIO:
builder
.eventLoopGroup(new NioEventLoopGroup(0, tf))
.channelType(NioSocketChannel.class);
break;
case NETTY_EPOLL:
// These classes only work on Linux.
builder
.eventLoopGroup(new EpollEventLoopGroup(0, tf))
.channelType(EpollSocketChannel.class);
break;
case NETTY_UNIX_DOMAIN_SOCKET:
// These classes only work on Linux.
builder
.eventLoopGroup(new EpollEventLoopGroup(0, tf))
.channelType(EpollDomainSocketChannel.class);
break;
default:
// Should never get here.
throw new IllegalArgumentException("Unsupported transport: " + transport);
}
return builder;
}
开发者ID:grpc,项目名称:grpc-java,代码行数:56,代码来源:Utils.java
注:本文中的io.netty.channel.epoll.EpollDomainSocketChannel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论