Example usage for io.netty.util.concurrent EventExecutorGroup next

List of usage examples for io.netty.util.concurrent EventExecutorGroup next

Introduction

In this page you can find the example usage for io.netty.util.concurrent EventExecutorGroup next.

Prototype

EventExecutor next();

Source Link

Document

Returns one of the EventExecutor s managed by this EventExecutorGroup .

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();
}

From source file:org.waarp.commandexec.server.LocalExecServerInitializer.java

License:Open Source License

/**
 * Constructor with default delay//from  w ww  .  j a v a  2 s. co m
 * 
 * @param eventExecutorGroup
 */
public LocalExecServerInitializer(EventExecutorGroup eventExecutorGroup) {
    this.eventExecutorGroup = eventExecutorGroup;
    channelGroup = new DefaultChannelGroup("LocalExecServer", eventExecutorGroup.next());
}

From source file:org.waarp.commandexec.server.LocalExecServerInitializer.java

License:Open Source License

/**
 * Constructor with a specific default delay
 * //from ww w .j av a  2 s . c  o m
 * @param newdelay
 * @param eventExecutorGroup
 */
public LocalExecServerInitializer(long newdelay, EventExecutorGroup eventExecutorGroup) {
    delay = newdelay;
    this.eventExecutorGroup = eventExecutorGroup;
    channelGroup = new DefaultChannelGroup("LocalExecServer", eventExecutorGroup.next());
}