io.netty.channel.EventLoop.parent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中io.netty.channel.EventLoop.parent()方法的一些代码示例,展示了EventLoop.parent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventLoop.parent()方法的具体详情如下:
包路径:io.netty.channel.EventLoop
类名称:EventLoop
方法名:parent

EventLoop.parent介绍

暂无

代码示例

代码示例来源:origin: line/armeria

/**
 * Returns whether the specified {@link EventLoop} supports any {@link TransportType}.
 */
public static boolean isSupported(EventLoop eventLoop) {
  final EventLoopGroup parent = eventLoop.parent();
  if (parent == null) {
    return false;
  }
  return isSupported(parent);
}

代码示例来源:origin: line/armeria

@Override
public EventLoopGroup parent() {
  return delegate().parent();
}

代码示例来源:origin: line/armeria

DnsEndpointGroup(EventLoop eventLoop, int minTtl, int maxTtl,
         DnsServerAddressStreamProvider serverAddressStreamProvider,
         Backoff backoff, Iterable<DnsQuestion> questions,
         Consumer<DnsNameResolverBuilder> resolverConfigurator) {
  this.eventLoop = eventLoop;
  this.minTtl = minTtl;
  this.maxTtl = maxTtl;
  this.backoff = backoff;
  this.questions = ImmutableList.copyOf(questions);
  assert !this.questions.isEmpty();
  logger = LoggerFactory.getLogger(getClass());
  logPrefix = this.questions.stream()
               .map(DnsQuestion::name)
               .distinct()
               .collect(Collectors.joining(", ", "[", "]"));
  final DnsNameResolverBuilder resolverBuilder = new DnsNameResolverBuilder(eventLoop)
      .channelType(TransportType.datagramChannelType(eventLoop.parent()))
      .ttl(minTtl, maxTtl)
      .nameServerProvider(serverAddressStreamProvider);
  resolverConfigurator.accept(resolverBuilder);
  resolver = resolverBuilder.build();
}

代码示例来源:origin: line/armeria

final EventLoopGroup bossGroup = ch.eventLoop().parent();
bossGroup.shutdownGracefully();
bossGroup.terminationFuture().addListener(unused6 -> {

代码示例来源:origin: aadnk/ProtocolLib

@Override
public EventLoopGroup parent() {
  return getDelegate().parent();
}

代码示例来源:origin: org.jboss.xnio.netty/netty-xnio-transport

@Override
protected boolean isCompatible(EventLoop loop) {
  if (!(loop instanceof XnioEventLoop)) {
    return false;
  }
  ServerSocketChannel parent = parent();
  if (parent != null) {
    // if this channel has a parent we need to ensure that both EventLoopGroups are the same for XNIO
    // to be sure it uses a Thread from the correct Worker.
    if (parent.eventLoop().parent() != loop.parent()) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: xjdr/xio

public static ChannelConfiguration clientConfig(EventLoopGroup workerGroup) {
  EventLoopGroup parent = workerGroup;
  if (parent instanceof EventLoop) {
   parent = ((EventLoop) workerGroup).parent();
  }
  Class<? extends Channel> channelClass;
  if (parent instanceof EpollEventLoopGroup) {
   channelClass = EpollSocketChannel.class;
  } else if (parent instanceof NioEventLoopGroup) {
   channelClass = NioSocketChannel.class;
  } else {
   throw new RuntimeException("Unsupported EventLoopGroup " + workerGroup.getClass());
  }

  return new ChannelConfiguration(workerGroup, channelClass);
 }
}

代码示例来源:origin: xjdr/xio

/**
 * This method will configure a worker EventLoopGroup and a Channel for use by a client. It will
 * try to use the correct SocketChannel for the provided workerGroup.
 *
 * @param workerGroup uses EventLoopGroup in the ClientChannelConfiguration
 * @return ClientChannelConfiguration
 */
public static ClientChannelConfiguration clientConfig(EventLoopGroup workerGroup) {
 EventLoopGroup parent = workerGroup;
 if (parent instanceof EventLoop) {
  parent = ((EventLoop) workerGroup).parent();
 }
 Class<? extends Channel> channelClass;
 if (parent instanceof EpollEventLoopGroup) {
  channelClass = EpollSocketChannel.class;
 } else if (parent instanceof NioEventLoopGroup) {
  channelClass = NioSocketChannel.class;
 } else {
  throw new RuntimeException("Unsupported EventLoopGroup " + workerGroup.getClass());
 }
 return new ClientChannelConfiguration(workerGroup, channelClass);
}

代码示例来源:origin: org.apache.plc4x/plc4j-protocol-s7

if (channel.eventLoop().parent() != null) {
  channel.eventLoop().parent().shutdownGracefully();

代码示例来源:origin: org.apache.plc4x/plc4j-driver-s7

if (channel.eventLoop().parent() != null) {
  channel.eventLoop().parent().shutdownGracefully();

相关文章