gpt4 book ai didi

io.netty.bootstrap.ZuulBootstrap.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 05:57:31 26 4
gpt4 key购买 nike

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

ZuulBootstrap.<init>介绍

暂无

代码示例

代码示例来源:origin: Netflix/zuul

public ChannelFuture connect(final EventLoop eventLoop, String host, final int port, CurrentPassport passport) {
  Class socketChannelClass;
  if (Server.USE_EPOLL.get()) {
    socketChannelClass = EpollSocketChannel.class;
  } else {
    socketChannelClass = NioSocketChannel.class;
  }
  SocketAddress socketAddress = new InetSocketAddress(host, port);
  final Bootstrap bootstrap = new Bootstrap()
      .channel(socketChannelClass)
      .handler(channelInitializer)
      .group(eventLoop)
      .attr(CurrentPassport.CHANNEL_ATTR, passport)
      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connPoolConfig.getConnectTimeout())
      .option(ChannelOption.SO_KEEPALIVE, connPoolConfig.getTcpKeepAlive())
      .option(ChannelOption.TCP_NODELAY, connPoolConfig.getTcpNoDelay())
      .option(ChannelOption.SO_SNDBUF, connPoolConfig.getTcpSendBufferSize())
      .option(ChannelOption.SO_RCVBUF, connPoolConfig.getTcpReceiveBufferSize())
      .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, connPoolConfig.getNettyWriteBufferHighWaterMark())
      .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, connPoolConfig.getNettyWriteBufferLowWaterMark())
      .option(ChannelOption.AUTO_READ, connPoolConfig.getNettyAutoRead())
      .remoteAddress(socketAddress);
  ZuulBootstrap zuulBootstrap = new ZuulBootstrap(bootstrap);
  if (!zuulBootstrap.getResolver(eventLoop).isResolved(socketAddress)) {
    LOGGER.warn("NettyClientConnectionFactory got an unresolved server address, host: " + host + ", port: " + port);
    unresolvedDiscoveryHost.increment();
  }
  return bootstrap.connect();
}

代码示例来源:origin: Netflix/zuul

public ChannelFuture connect(final EventLoop eventLoop, String host, final int port, CurrentPassport passport) {
  Class socketChannelClass;
  if (Server.USE_EPOLL.get()) {
    socketChannelClass = EpollSocketChannel.class;
  } else {
    socketChannelClass = NioSocketChannel.class;
  }
  SocketAddress socketAddress = new InetSocketAddress(host, port);
  final Bootstrap bootstrap = new Bootstrap()
      .channel(socketChannelClass)
      .handler(channelInitializer)
      .group(eventLoop)
      .attr(CurrentPassport.CHANNEL_ATTR, passport)
      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connPoolConfig.getConnectTimeout())
      .option(ChannelOption.SO_KEEPALIVE, connPoolConfig.getTcpKeepAlive())
      .option(ChannelOption.TCP_NODELAY, connPoolConfig.getTcpNoDelay())
      .option(ChannelOption.SO_SNDBUF, connPoolConfig.getTcpSendBufferSize())
      .option(ChannelOption.SO_RCVBUF, connPoolConfig.getTcpReceiveBufferSize())
      .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, connPoolConfig.getNettyWriteBufferHighWaterMark())
      .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, connPoolConfig.getNettyWriteBufferLowWaterMark())
      .option(ChannelOption.AUTO_READ, connPoolConfig.getNettyAutoRead())
      .remoteAddress(socketAddress);
  ZuulBootstrap zuulBootstrap = new ZuulBootstrap(bootstrap);
  if (!zuulBootstrap.getResolver(eventLoop).isResolved(socketAddress)) {
    LOGGER.warn("NettyClientConnectionFactory got an unresolved server address, host: " + host + ", port: " + port);
    unresolvedDiscoveryHost.increment();
  }
  return bootstrap.connect();
}

代码示例来源:origin: com.netflix.zuul/zuul-core

public ChannelFuture connect(final EventLoop eventLoop, String host, final int port, CurrentPassport passport) {
  Class socketChannelClass;
  if (Server.USE_EPOLL.get()) {
    socketChannelClass = EpollSocketChannel.class;
  } else {
    socketChannelClass = NioSocketChannel.class;
  }
  SocketAddress socketAddress = new InetSocketAddress(host, port);
  final Bootstrap bootstrap = new Bootstrap()
      .channel(socketChannelClass)
      .handler(channelInitializer)
      .group(eventLoop)
      .attr(CurrentPassport.CHANNEL_ATTR, passport)
      .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connPoolConfig.getConnectTimeout())
      .option(ChannelOption.SO_KEEPALIVE, connPoolConfig.getTcpKeepAlive())
      .option(ChannelOption.TCP_NODELAY, connPoolConfig.getTcpNoDelay())
      .option(ChannelOption.SO_SNDBUF, connPoolConfig.getTcpSendBufferSize())
      .option(ChannelOption.SO_RCVBUF, connPoolConfig.getTcpReceiveBufferSize())
      .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, connPoolConfig.getNettyWriteBufferHighWaterMark())
      .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, connPoolConfig.getNettyWriteBufferLowWaterMark())
      .option(ChannelOption.AUTO_READ, connPoolConfig.getNettyAutoRead())
      .remoteAddress(socketAddress);
  ZuulBootstrap zuulBootstrap = new ZuulBootstrap(bootstrap);
  if (!zuulBootstrap.getResolver(eventLoop).isResolved(socketAddress)) {
    LOGGER.warn("NettyClientConnectionFactory got an unresolved server address, host: " + host + ", port: " + port);
    unresolvedDiscoveryHost.increment();
  }
  return bootstrap.connect();
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com