io.netty.channel.nio.NioEventLoopGroup.next()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(285)

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

NioEventLoopGroup.next介绍

暂无

代码示例

代码示例来源:origin: Graylog2/graylog2-server

public void start(String dnsServerIps, long requestTimeout) {
  LOG.debug("Attempting to start DNS client");
  final List<InetSocketAddress> iNetDnsServerIps = parseServerIpAddresses(dnsServerIps);
  nettyEventLoop = new NioEventLoopGroup();
  final DnsNameResolverBuilder dnsNameResolverBuilder = new DnsNameResolverBuilder(nettyEventLoop.next());
  dnsNameResolverBuilder.channelType(NioDatagramChannel.class).queryTimeoutMillis(requestTimeout);
  // Specify custom DNS servers if provided. If not, use those specified in local network adapter settings.
  if (CollectionUtils.isNotEmpty(iNetDnsServerIps)) {
    LOG.debug("Attempting to start DNS client with server IPs [{}] on port [{}] with timeout [{}]",
         dnsServerIps, DEFAULT_DNS_PORT, requestTimeout);
    final DnsServerAddressStreamProvider dnsServer = new SequentialDnsServerAddressStreamProvider(iNetDnsServerIps);
    dnsNameResolverBuilder.nameServerProvider(dnsServer);
  } else {
    LOG.debug("Attempting to start DNS client with the local network adapter DNS server address on port [{}] with timeout [{}]",
         DEFAULT_DNS_PORT, requestTimeout);
  }
  resolver = dnsNameResolverBuilder.build();
  LOG.debug("DNS client startup successful");
}

代码示例来源:origin: apache/hive

.connect(host, port);
final Promise<Rpc> promise = eloop.next().newPromise();
final AtomicReference<Rpc> rpc = new AtomicReference<Rpc>();

代码示例来源:origin: in.jlibs/jlibs-wamp4j-netty

@Override
public boolean isEventLoop(){
  return eventLoopGroup.next().inEventLoop();
}

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-tools

@Activate
protected void activate(ComponentContext ctx) throws Exception {
  Dictionary<?, ?> props = ctx.getProperties();
  this.port = PropertiesUtil.toInteger(props.get(PROP_PORT), DEFAULT_PORT);
  this.pathPrefixes = PropertiesUtil.toStringArray(props.get(PROP_PREFIXES), DEFAULT_PREFIXES);
  this.broadcastGroup = new NioEventLoopGroup(1);
  this.group = new DefaultChannelGroup("live-reload", broadcastGroup.next());
  this.infos = new ConcurrentHashMap<Channel, ChannelInfo>();
  this.matcher = new ContentPageMatcher();
  startServer();
  running = true;
  if (PropertiesUtil.toBoolean(props.get(PROP_JS_FILTER_ENABLED), DEFAULT_JS_FILTER_ENABLED)) {
    Dictionary<Object, Object> filterProps = new Hashtable<Object, Object>();
    filterProps.put("sling.filter.scope", "request");
    filterProps.put("filter.order", FILTER_ORDER);
    filterReference = ctx.getBundleContext().registerService(Filter.class.getName(),
        new JavaScriptInjectionFilter(port, pathPrefixes), filterProps);
  }
}

代码示例来源:origin: com.adobe.acs/acs-aem-tools-bundle-livereload

@Activate
protected void activate(ComponentContext ctx) throws Exception {
  Dictionary<?, ?> props = ctx.getProperties();
  this.port = PropertiesUtil.toInteger(props.get(PROP_PORT), DEFAULT_PORT);
  this.pathPrefixes = PropertiesUtil.toStringArray(props.get(PROP_PREFIXES), DEFAULT_PREFIXES);
  this.broadcastGroup = new NioEventLoopGroup(1);
  this.group = new DefaultChannelGroup("live-reload", broadcastGroup.next());
  this.infos = new ConcurrentHashMap<Channel, ChannelInfo>();
  this.matcher = new ContentPageMatcher();
  startServer();
  running = true;
  if (PropertiesUtil.toBoolean(props.get(PROP_JS_FILTER_ENABLED), DEFAULT_JS_FILTER_ENABLED)) {
    Dictionary<Object, Object> filterProps = new Hashtable<Object, Object>();
    filterProps.put("sling.filter.scope", "request");
    filterProps.put("filter.order", FILTER_ORDER);
    filterReference = ctx.getBundleContext().registerService(Filter.class.getName(),
        new JavaScriptInjectionFilter(port, pathPrefixes), filterProps);
  }
}

代码示例来源:origin: org.graylog2/graylog2-server

public void start(String dnsServerIps, long requestTimeout) {
  LOG.debug("Attempting to start DNS client");
  final List<InetSocketAddress> iNetDnsServerIps = parseServerIpAddresses(dnsServerIps);
  nettyEventLoop = new NioEventLoopGroup();
  final DnsNameResolverBuilder dnsNameResolverBuilder = new DnsNameResolverBuilder(nettyEventLoop.next());
  dnsNameResolverBuilder.channelType(NioDatagramChannel.class).queryTimeoutMillis(requestTimeout);
  // Specify custom DNS servers if provided. If not, use those specified in local network adapter settings.
  if (CollectionUtils.isNotEmpty(iNetDnsServerIps)) {
    LOG.debug("Attempting to start DNS client with server IPs [{}] on port [{}] with timeout [{}]",
         dnsServerIps, DEFAULT_DNS_PORT, requestTimeout);
    final DnsServerAddressStreamProvider dnsServer = new SequentialDnsServerAddressStreamProvider(iNetDnsServerIps);
    dnsNameResolverBuilder.nameServerProvider(dnsServer);
  } else {
    LOG.debug("Attempting to start DNS client with the local network adapter DNS server address on port [{}] with timeout [{}]",
         DEFAULT_DNS_PORT, requestTimeout);
  }
  resolver = dnsNameResolverBuilder.build();
  LOG.debug("DNS client startup successful");
}

代码示例来源:origin: com.github.hyukjinkwon/spark-client

.connect(host, port);
final Promise<Rpc> promise = eloop.next().newPromise();
final AtomicReference<Rpc> rpc = new AtomicReference<Rpc>();

代码示例来源:origin: org.spark-project.hive/spark-client

.connect(host, port);
final Promise<Rpc> promise = eloop.next().newPromise();
final AtomicReference<Rpc> rpc = new AtomicReference<Rpc>();

代码示例来源:origin: org.neo4j/neo4j-causal-clustering

private Channel channel( AdvertisedSocketAddress destination )
{
  ReconnectingChannel channel = channels.get( destination );
  if ( channel == null )
  {
    channel = new ReconnectingChannel( bootstrap, eventLoopGroup.next(), destination, log );
    channel.start();
    ReconnectingChannel existingNonBlockingChannel = channels.putIfAbsent( destination, channel );
    if ( existingNonBlockingChannel != null )
    {
      channel.dispose();
      channel = existingNonBlockingChannel;
    }
    else
    {
      log.info( "Creating channel to: [%s] ", destination );
    }
  }
  return channel;
}

代码示例来源:origin: com.linkedin.pegasus/r2-netty

@Override
public ChannelPoolManager buildRest(ChannelPoolManagerKey channelPoolManagerKey)
 DefaultChannelGroup channelGroup = new DefaultChannelGroup("R2 client channels", _eventLoopGroup.next());

代码示例来源:origin: com.linkedin.pegasus/r2-netty

@Override
public ChannelPoolManager buildHttp2Stream(ChannelPoolManagerKey channelPoolManagerKey)
{
 DefaultChannelGroup channelGroup = new DefaultChannelGroup("R2 client channels", _eventLoopGroup.next());
 return new ChannelPoolManagerImpl(
  new Http2NettyStreamChannelPoolFactory(
   channelPoolManagerKey.getIdleTimeout(),
   channelPoolManagerKey.getPoolWaiterSize(),
   channelPoolManagerKey.getMinPoolSize(),
   channelPoolManagerKey.isTcpNoDelay(),
   _scheduler,
   channelPoolManagerKey.getSslContext(),
   channelPoolManagerKey.getSslParameters(),
   channelPoolManagerKey.getGracefulShutdownTimeout(),
   channelPoolManagerKey.getMaxHeaderSize(),
   channelPoolManagerKey.getMaxChunkSize(),
   channelPoolManagerKey.getMaxResponseSize(),
   _eventLoopGroup,
   channelGroup),
  channelPoolManagerKey.getName() + "-HTTP/2-Stream",
  channelGroup,
  _scheduler);
}

代码示例来源:origin: com.linkedin.pegasus/r2-netty

@Override
public ChannelPoolManager buildStream(ChannelPoolManagerKey channelPoolManagerKey)
{
 DefaultChannelGroup channelGroup = new DefaultChannelGroup("R2 client channels", _eventLoopGroup.next());
 return new ChannelPoolManagerImpl(
  new HttpNettyStreamChannelPoolFactory(
   channelPoolManagerKey.getMaxPoolSize(),
   channelPoolManagerKey.getIdleTimeout(),
   channelPoolManagerKey.getPoolWaiterSize(),
   channelPoolManagerKey.getStrategy(),
   channelPoolManagerKey.getMinPoolSize(),
   channelPoolManagerKey.isTcpNoDelay(),
   _scheduler,
   channelPoolManagerKey.getMaxConcurrentConnectionInitializations(),
   channelPoolManagerKey.getSslContext(),
   channelPoolManagerKey.getSslParameters(),
   channelPoolManagerKey.getMaxHeaderSize(),
   channelPoolManagerKey.getMaxChunkSize(),
   channelPoolManagerKey.getMaxResponseSize(),
   _eventLoopGroup,
   channelGroup),
  channelPoolManagerKey.getName() + "-Stream",
  channelGroup,
  _scheduler);
}

相关文章