Package io.netty.channel.local

Examples of io.netty.channel.local.LocalChannel.eventLoop()


        registerPromise = channel.newPromise();
        channel.unsafe().register(loopB,  registerPromise);
        assertTrue(registerPromise.sync().isSuccess());
        assertTrue(((PausableEventExecutor) channel.eventLoop()).isAcceptingNewTasks());

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopB, channel.eventLoop().unwrap());

        // 100ms internal delay + 1 second. Should be able to execute 5 tasks in that time.
        Thread.sleep(1150);
        assertTrue(scheduleFuture.cancel(true));
View Full Code Here


        channel.unsafe().register(loopB,  registerPromise);
        assertTrue(registerPromise.sync().isSuccess());
        assertTrue(((PausableEventExecutor) channel.eventLoop()).isAcceptingNewTasks());

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopB, channel.eventLoop().unwrap());

        // 100ms internal delay + 1 second. Should be able to execute 5 tasks in that time.
        Thread.sleep(1150);
        assertTrue(scheduleFuture.cancel(true));
View Full Code Here

        LocalChannel channel = new LocalChannel();
        ChannelPromise registerPromise = channel.newPromise();
        channel.unsafe().register(loopA, registerPromise);
        registerPromise.sync();

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopA, ((PausableEventExecutor) channel.eventLoop()).unwrap());

        io.netty.util.concurrent.ScheduledFuture<?> scheduleFuture = channel.eventLoop().schedule(new Runnable() {
            @Override
            public void run() {
View Full Code Here

        ChannelPromise registerPromise = channel.newPromise();
        channel.unsafe().register(loopA, registerPromise);
        registerPromise.sync();

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopA, ((PausableEventExecutor) channel.eventLoop()).unwrap());

        io.netty.util.concurrent.ScheduledFuture<?> scheduleFuture = channel.eventLoop().schedule(new Runnable() {
            @Override
            public void run() {
                oneTimeScheduledTaskExecuted.set(true);
View Full Code Here

        registerPromise.sync();

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopA, ((PausableEventExecutor) channel.eventLoop()).unwrap());

        io.netty.util.concurrent.ScheduledFuture<?> scheduleFuture = channel.eventLoop().schedule(new Runnable() {
            @Override
            public void run() {
                oneTimeScheduledTaskExecuted.set(true);
                assertTrue(loopB.inEventLoop());
            }
View Full Code Here

                oneTimeScheduledTaskExecuted.set(true);
                assertTrue(loopB.inEventLoop());
            }
        }, 1, TimeUnit.SECONDS);

        assertTrue(((PausableEventExecutor) channel.eventLoop()).isAcceptingNewTasks());
        ChannelFuture deregisterFuture = channel.deregister();
        assertFalse(((PausableEventExecutor) channel.eventLoop()).isAcceptingNewTasks());

        assertTrue(deregisterFuture.sync().isSuccess());
View Full Code Here

            }
        }, 1, TimeUnit.SECONDS);

        assertTrue(((PausableEventExecutor) channel.eventLoop()).isAcceptingNewTasks());
        ChannelFuture deregisterFuture = channel.deregister();
        assertFalse(((PausableEventExecutor) channel.eventLoop()).isAcceptingNewTasks());

        assertTrue(deregisterFuture.sync().isSuccess());

        Thread.sleep(1000);
View Full Code Here

        registerPromise = channel.newPromise();
        assertFalse(oneTimeScheduledTaskExecuted.get());
        channel.unsafe().register(loopB, registerPromise);
        registerPromise.sync();

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopB, ((PausableEventExecutor) channel.eventLoop()).unwrap());

        assertTrue(scheduleFuture.sync().isSuccess());
        assertTrue(oneTimeScheduledTaskExecuted.get());
    }
View Full Code Here

        assertFalse(oneTimeScheduledTaskExecuted.get());
        channel.unsafe().register(loopB, registerPromise);
        registerPromise.sync();

        assertThat(channel.eventLoop(), instanceOf(PausableEventExecutor.class));
        assertSame(loopB, ((PausableEventExecutor) channel.eventLoop()).unwrap());

        assertTrue(scheduleFuture.sync().isSuccess());
        assertTrue(oneTimeScheduledTaskExecuted.get());
    }
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.