Examples of OneTimeTask


Examples of io.netty.util.internal.OneTimeTask

        if (newExecutor instanceof SingleThreadEventExecutor) {
            if (!newExecutor.isShutdown()) {
                executor = newExecutor;
                delayedTaskQueue = ((SingleThreadEventExecutor) newExecutor).delayedTaskQueue;

                executor.execute(new OneTimeTask() {
                    @Override
                    public void run() {
                        // Execute as soon as possible.
                        deadlineNanos = nanoTime();
                        if (!isCancelled()) {
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

            if (eventLoop.inEventLoop()) {
                register0(promise);
            } else {
                try {
                    eventLoop.execute(new OneTimeTask() {
                        @Override
                        public void run() {
                            register0(promise);
                        }
                    });
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

                closeIfClosed();
                return;
            }

            if (!wasActive && isActive()) {
                invokeLater(new OneTimeTask() {
                    @Override
                    public void run() {
                        pipeline.fireChannelActive();
                    }
                });
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

                closeIfClosed();
                return;
            }

            if (wasActive && !isActive()) {
                invokeLater(new OneTimeTask() {
                    @Override
                    public void run() {
                        pipeline.fireChannelInactive();
                    }
                });
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

            if (!promise.setUncancellable()) {
                return;
            }

            if (inFlush0) {
                invokeLater(new OneTimeTask() {
                    @Override
                    public void run() {
                        close(promise);
                    }
                });
                return;
            }

            if (closeFuture.isDone()) {
                // Closed already.
                safeSetSuccess(promise);
                return;
            }

            boolean wasActive = isActive();
            ChannelOutboundBuffer outboundBuffer = this.outboundBuffer;
            this.outboundBuffer = null; // Disallow adding any messages and flushes to outboundBuffer.

            try {
                doClose();
                closeFuture.setClosed();
                safeSetSuccess(promise);
            } catch (Throwable t) {
                closeFuture.setClosed();
                safeSetFailure(promise, t);
            }

            // Fail all the queued messages
            try {
                outboundBuffer.failFlushed(CLOSED_CHANNEL_EXCEPTION);
                outboundBuffer.close(CLOSED_CHANNEL_EXCEPTION);
            } finally {
                if (wasActive && !isActive()) {
                    invokeLater(new OneTimeTask() {
                        @Override
                        public void run() {
                            pipeline.fireChannelInactive();
                            deregister(voidPromise());
                        }
                    });
                } else {
                    invokeLater(new OneTimeTask() {
                        @Override
                        public void run() {
                            deregister(voidPromise());
                        }
                    });
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

            }

            try {
                doBeginRead();
            } catch (final Exception e) {
                invokeLater(new OneTimeTask() {
                    @Override
                    public void run() {
                        pipeline.fireExceptionCaught(e);
                    }
                });
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

                promise.setSuccess();
            } catch (Throwable t) {
                promise.setFailure(t);
            }
        } else {
            loop.execute(new OneTimeTask() {
                @Override
                public void run() {
                    shutdownOutput(promise);
                }
            });
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

            final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe();
            if (loop.inEventLoop()) {
                unsafe.clearEpollIn0();
            } else {
                // schedule a task to clear the EPOLLIN as it is not safe to modify it directly
                loop.execute(new OneTimeTask() {
                    @Override
                    public void run() {
                        if (!config().isAutoRead() && !unsafe.readPending) {
                            // Still no read triggered so clear it now
                            unsafe.clearEpollIn0();
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

                    requestedRemoteAddress = remoteAddress;

                    // Schedule connect timeout.
                    int connectTimeoutMillis = config().getConnectTimeoutMillis();
                    if (connectTimeoutMillis > 0) {
                        connectTimeoutFuture = eventLoop().schedule(new OneTimeTask() {
                            @Override
                            public void run() {
                                ChannelPromise connectPromise = AbstractNioChannel.this.connectPromise;
                                ConnectTimeoutException cause =
                                        new ConnectTimeoutException("connection timed out: " + remoteAddress);
View Full Code Here

Examples of io.netty.util.internal.OneTimeTask

        @Override
        public void deregister(ChannelHandlerContext ctx, final ChannelPromise promise) throws Exception {
            assert !((PausableEventExecutor) ctx.channel().eventLoop()).isAcceptingNewTasks();

            // submit deregistration task
            ctx.channel().eventLoop().unwrap().execute(new OneTimeTask() {
                @Override
                public void run() {
                    unsafe.deregister(promise);
                }
            });
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.