Example usage for io.netty.channel.nio NioEventLoopGroup executorCount

List of usage examples for io.netty.channel.nio NioEventLoopGroup executorCount

Introduction

In this page you can find the example usage for io.netty.channel.nio NioEventLoopGroup executorCount.

Prototype

public final int executorCount() 

Source Link

Document

Return the number of EventExecutor this implementation uses.

Usage

From source file:cn.wantedonline.puppy.httpserver.stat.NioWorkerStat.java

License:Apache License

public void registerWorkers(NioEventLoopGroup eventLoopGroup) {
    Iterator<EventExecutor> iterator = eventLoopGroup.iterator();
    workExecutors = new ArrayList<>(eventLoopGroup.executorCount());
    while (iterator.hasNext()) {
        workExecutors.add((NioEventLoop) iterator.next());
    }/*from w w w  . j a  v  a2  s  .  co  m*/
    inited = true;
}

From source file:com.lambdaworks.redis.resource.DefaultClientResourcesTest.java

License:Apache License

@Test
public void testBuilder() throws Exception {

    DefaultClientResources sut = new DefaultClientResources.Builder().ioThreadPoolSize(4)
            .computationThreadPoolSize(4)
            .commandLatencyCollectorOptions(DefaultCommandLatencyCollectorOptions.disabled()).build();

    EventExecutorGroup eventExecutors = sut.eventExecutorGroup();
    NioEventLoopGroup eventLoopGroup = sut.eventLoopGroupProvider().allocate(NioEventLoopGroup.class);

    assertThat(eventExecutors.iterator()).hasSize(4);
    assertThat(eventLoopGroup.executorCount()).isEqualTo(4);
    assertThat(sut.ioThreadPoolSize()).isEqualTo(4);
    assertThat(sut.commandLatencyCollector()).isNotNull();
    assertThat(sut.commandLatencyCollector().isEnabled()).isFalse();

    assertThat(sut.shutdown(0, 0, TimeUnit.MILLISECONDS).get()).isTrue();
}

From source file:com.lambdaworks.redis.resource.DefaultClientResourcesTest.java

License:Apache License

@Test
public void testSmallPoolSize() throws Exception {

    DefaultClientResources sut = new DefaultClientResources.Builder().ioThreadPoolSize(1)
            .computationThreadPoolSize(1).build();

    EventExecutorGroup eventExecutors = sut.eventExecutorGroup();
    NioEventLoopGroup eventLoopGroup = sut.eventLoopGroupProvider().allocate(NioEventLoopGroup.class);

    assertThat(eventExecutors.iterator()).hasSize(3);
    assertThat(eventLoopGroup.executorCount()).isEqualTo(3);
    assertThat(sut.ioThreadPoolSize()).isEqualTo(3);

    assertThat(sut.shutdown(0, 0, TimeUnit.MILLISECONDS).get()).isTrue();
}

From source file:io.lettuce.core.resource.DefaultClientResourcesTest.java

License:Apache License

@Test
public void testBuilder() throws Exception {

    DefaultClientResources sut = DefaultClientResources.builder().ioThreadPoolSize(4)
            .computationThreadPoolSize(4)
            .commandLatencyCollectorOptions(DefaultCommandLatencyCollectorOptions.disabled()).build();

    EventExecutorGroup eventExecutors = sut.eventExecutorGroup();
    NioEventLoopGroup eventLoopGroup = sut.eventLoopGroupProvider().allocate(NioEventLoopGroup.class);

    assertThat(eventExecutors.iterator()).hasSize(4);
    assertThat(eventLoopGroup.executorCount()).isEqualTo(4);
    assertThat(sut.ioThreadPoolSize()).isEqualTo(4);
    assertThat(sut.commandLatencyCollector()).isNotNull();
    assertThat(sut.commandLatencyCollector().isEnabled()).isFalse();

    assertThat(sut.shutdown(0, 0, TimeUnit.MILLISECONDS).get()).isTrue();
}

From source file:io.lettuce.core.resource.DefaultClientResourcesTest.java

License:Apache License

@Test
public void testSmallPoolSize() throws Exception {

    DefaultClientResources sut = DefaultClientResources.builder().ioThreadPoolSize(1)
            .computationThreadPoolSize(1).build();

    EventExecutorGroup eventExecutors = sut.eventExecutorGroup();
    NioEventLoopGroup eventLoopGroup = sut.eventLoopGroupProvider().allocate(NioEventLoopGroup.class);

    assertThat(eventExecutors.iterator()).hasSize(3);
    assertThat(eventLoopGroup.executorCount()).isEqualTo(3);
    assertThat(sut.ioThreadPoolSize()).isEqualTo(3);

    assertThat(sut.shutdown(0, 0, TimeUnit.MILLISECONDS).get()).isTrue();
}