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

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

Introduction

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

Prototype

@Override
    public boolean isTerminated() 

Source Link

Usage

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

License:Apache License

@Test
public void testDefaults() throws Exception {

    DefaultClientResources sut = DefaultClientResources.create();

    assertThat(sut.commandLatencyCollector()).isNotNull();
    assertThat(sut.commandLatencyCollector().isEnabled()).isTrue();

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

    eventExecutors.next().submit(mock(Runnable.class));
    eventLoopGroup.next().submit(mock(Runnable.class));

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

    assertThat(eventExecutors.isTerminated()).isTrue();
    assertThat(eventLoopGroup.isTerminated()).isTrue();

    Future<Boolean> shutdown = sut.eventLoopGroupProvider().shutdown(0, 0, TimeUnit.SECONDS);
    assertThat(shutdown.get()).isTrue();

    assertThat(sut.commandLatencyCollector().isEnabled()).isFalse();
}