Package io.netty.channel.nio

Examples of io.netty.channel.nio.NioEventLoopGroup


        File cert = Paths.get(getClass().getResource("/ssl/server.pem").toURI()).toFile();
        File keyStore = Paths.get(getClass().getResource("/ssl/server.key").toURI()).toFile();

        SslContext sslCtx = SslContext.newServerContext(cert, keyStore);

        bossGroup = new NioEventLoopGroup(1);
        workerGroup = new NioEventLoopGroup();

        server = new ServerBootstrap();
        server.group(bossGroup, workerGroup)
              .channel(NioServerSocketChannel.class)
              .option(ChannelOption.SO_BACKLOG, 100)
View Full Code Here


*/
public class NioServerLoopGroup implements ServerLoopGroup {
 
  @Override
  public EventLoopGroup boss() {
    return new NioEventLoopGroup();
  }
View Full Code Here

    return new NioEventLoopGroup();
  }

  @Override
  public EventLoopGroup event() {
    return new NioEventLoopGroup();
  }
View Full Code Here

  // Configure the server.

  if (Epoll.isAvailable()) {
      doRun(new EpollEventLoopGroup(), EpollServerSocketChannel.class);
  } else {
      doRun(new NioEventLoopGroup(), NioServerSocketChannel.class);
  }
    }
View Full Code Here

  private static NioEventLoopGroup eventLoopGroup;

  @BeforeClass
  public static void setUpBeforeClass() {
    ApnsConnectionPoolTest.eventLoopGroup = new NioEventLoopGroup();
  }
View Full Code Here

  @Rule
  public Timeout globalTimeout = new Timeout(10000);

  @BeforeClass
  public static void setUpBeforeClass() {
    BasePushyTest.eventLoopGroup = new NioEventLoopGroup();
  }
View Full Code Here

      this.notifications.add(new SimpleApnsPushNotification(token, builder.buildWithDefaultMaximumLength()));
    }
  }

  public void runAllBenchmarks() throws InterruptedException {
    this.serverEventLoopGroup = new NioEventLoopGroup(2);
    this.server = new MockApnsServer(GATEWAY_PORT, serverEventLoopGroup);

    // We want to do a dummy run first to let the JVM warm up
    final NioEventLoopGroup warmupGroup = new NioEventLoopGroup(1);
    this.runBenchmark(warmupGroup, 1, this.notifications);
    warmupGroup.shutdownGracefully().await();

    System.out.println("threads, connections, throughput [k/sec]");

    for (int eventLoopGroupThreadCount : new int[] {1, 2, 4, 8, 16}) {
      final NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(eventLoopGroupThreadCount);

      for (int concurrentConnectionCount : new int[] {1, 2, 4, 8, 16, 32}) {
        if (concurrentConnectionCount >= eventLoopGroupThreadCount) {
          System.gc();

          double throughput = this.runBenchmark(eventLoopGroup, concurrentConnectionCount, this.notifications);

          System.out.format("%d, %d, %.1f\n",
              eventLoopGroupThreadCount,
              concurrentConnectionCount,
              throughput / 1000.0);
        }
      }

      eventLoopGroup.shutdownGracefully().await();
    }

    this.serverEventLoopGroup.shutdownGracefully().await();
  }
View Full Code Here

    } else {
      // Never use more threads than concurrent connections (Netty binds a channel to a single thread, so the
      // excess threads would always go unused)
      final int threadCount = Math.min(this.configuration.getConcurrentConnectionCount(), Runtime.getRuntime().availableProcessors() * 2);

      this.eventLoopGroup = new NioEventLoopGroup(threadCount);
      this.shouldShutDownEventLoopGroup = true;
    }

    if (listenerExecutorService != null) {
      this.listenerExecutorService = listenerExecutorService;
View Full Code Here

      assertTrue(defaultGroupPushManager.isShutDown());
    }

    {
      final NioEventLoopGroup group = new NioEventLoopGroup(1);

      final PushManager<ApnsPushNotification> providedGroupPushManager =
          new PushManager<ApnsPushNotification>(TEST_ENVIRONMENT, SSLTestUtil.createSSLContextForTestClient(),
              group, null, null, new PushManagerConfiguration(), TEST_PUSH_MANAGER_NAME);

      providedGroupPushManager.start();
      providedGroupPushManager.shutdown();

      assertTrue(providedGroupPushManager.isShutDown());
      assertFalse(group.isShutdown());

      group.shutdownGracefully();
    }

    {
      final ExecutorService listenerExecutorService = Executors.newSingleThreadExecutor();
View Full Code Here

    private int receivedCount;
    private EventLoopGroup group;
    private Bootstrap bootstrap;

    public void createNettyUdpReceiver() {
        group = new NioEventLoopGroup();
        bootstrap = new Bootstrap();
        bootstrap.group(group)
                .channel(NioDatagramChannel.class)
                .handler(new ChannelInitializer<Channel>() {
                    @Override
View Full Code Here

TOP

Related Classes of io.netty.channel.nio.NioEventLoopGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.