Examples of eventLoop()


Examples of io.netty.channel.Channel.eventLoop()

            Channel sc = sb.bind(addr).sync().channel();

            final CountDownLatch latch = new CountDownLatch(1);
            // Connect to the server
            final Channel cc = cb.connect(addr).sync().channel();
            cc.eventLoop().execute(new Runnable() {
                @Override
                public void run() {
                    // Send a message event up the pipeline.
                    cc.pipeline().fireChannelRead("Hello, World");
                    latch.countDown();
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

        if (regFuture.cause() != null) {
            return regFuture;
        }

        final Channel channel = regFuture.channel();
        final EventLoop eventLoop = channel.eventLoop();
        final NameResolver<SocketAddress> resolver = this.resolver.getResolver(eventLoop);

        if (!resolver.isSupported(remoteAddress) || resolver.isResolved(remoteAddress)) {
            // Resolver has no idea about what to do with the specified remote address or it's resolved already.
            return doConnect(remoteAddress, localAddress, regFuture, channel.newPromise());
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

            final ChannelPromise connectPromise) {

        // This method is invoked before channelRegistered() is triggered.  Give user handlers a chance to set up
        // the pipeline in its channelRegistered() implementation.
        final Channel channel = connectPromise.channel();
        channel.eventLoop().execute(new Runnable() {
            @Override
            public void run() {
                if (regFuture.isSuccess()) {
                    if (localAddress == null) {
                        channel.connect(remoteAddress, connectPromise);
View Full Code Here

Examples of io.netty.channel.Channel.eventLoop()

                        // IllegalStateException once we try to access the EventLoop of the Channel.
                        promise.setFailure(cause);
                    } else {
                        // Registration was successful, so set the correct executor to use.
                        // See https://github.com/netty/netty/issues/2586
                        promise.executor = channel.eventLoop();
                    }
                    doBind0(regFuture, channel, localAddress, promise);
                }
            });
            return promise;
View Full Code Here

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

        registerPromise.sync();

        for (int i = 0; i < numtasks; i++) {
            Queue<Long> timestamps = new LinkedBlockingQueue<Long>();
            timestampsPerTask.add(timestamps);
            scheduledFutures.add(channel.eventLoop()
                    .scheduleAtFixedRate(new TimestampsRunnable(timestamps), 0, 100, TimeUnit.MILLISECONDS));
        }

        // Each task should be executed every 100ms.
        // Will give them additional 50ms to execute ten times.
View Full Code Here

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

            ChannelPromise registerPromise = channel.newPromise();
            channel.unsafe().register(i.intValue() % 2 == 0 ? loopA : loopB, registerPromise);
            registerPromise.sync();

            if (firstRun) {
                f = channel.eventLoop().scheduleAtFixedRate(new Runnable() {
                    @Override
                    public void run() {
                        assertTrue((i.intValue() % 2 == 0 ? loopA : loopB).inEventLoop());
                        timestamps.add(System.nanoTime());
                    }
View Full Code Here

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

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

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

        ScheduledFuture<?> scheduleFuture;
        if (PeriodicScheduleMethod.FIXED_RATE == method) {
            scheduleFuture = channel.eventLoop().scheduleAtFixedRate(new Runnable() {
View Full Code Here

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

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

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

        ScheduledFuture<?> scheduleFuture;
        if (PeriodicScheduleMethod.FIXED_RATE == method) {
            scheduleFuture = channel.eventLoop().scheduleAtFixedRate(new Runnable() {
                @Override
View Full Code Here

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

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

        ScheduledFuture<?> scheduleFuture;
        if (PeriodicScheduleMethod.FIXED_RATE == method) {
            scheduleFuture = channel.eventLoop().scheduleAtFixedRate(new Runnable() {
                @Override
                public void run() {
                    assertTrue(loopB.inEventLoop());
                    timestamps.add(System.nanoTime());
                }
View Full Code Here

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

                    assertTrue(loopB.inEventLoop());
                    timestamps.add(System.nanoTime());
                }
            }, 100, 200, TimeUnit.MILLISECONDS);
        } else {
            scheduleFuture = channel.eventLoop().scheduleWithFixedDelay(new Runnable() {
                @Override
                public void run() {
                    assertTrue(loopB.inEventLoop());
                    timestamps.add(System.nanoTime());
                }
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.