• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EpollDomainSocketChannel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DuplicateElementsRequest类代码示例发布时间:2022-05-23
下一篇:
Java DeviceListener类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap