Examples of NioEventLoopGroup


Examples of io.fletty.channel.nio.NioEventLoopGroup

            return false;
        }

        lock.writeLock().lock();
        this.handler = handler;
        loopGroup = new NioEventLoopGroup();
        lock.writeLock().unlock();
        handler.go();
        return true;
    }
View Full Code Here

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

Examples of io.netty.channel.nio.NioEventLoopGroup

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

Examples of io.netty.channel.nio.NioEventLoopGroup

    return new NioEventLoopGroup();
  }

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

Examples of io.netty.channel.nio.NioEventLoopGroup

  // Configure the server.

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

Examples of io.netty.channel.nio.NioEventLoopGroup

  private static NioEventLoopGroup eventLoopGroup;

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

Examples of io.netty.channel.nio.NioEventLoopGroup

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

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

Examples of io.netty.channel.nio.NioEventLoopGroup

      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

Examples of io.netty.channel.nio.NioEventLoopGroup

    } 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

Examples of io.netty.channel.nio.NioEventLoopGroup

      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
TOP
Copyright © 2018 www.massapi.com. 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.