当前位置: 首页>>代码示例>>Java>>正文


Java EventExecutor.execute方法代码示例

本文整理汇总了Java中io.netty.util.concurrent.EventExecutor.execute方法的典型用法代码示例。如果您正苦于以下问题:Java EventExecutor.execute方法的具体用法?Java EventExecutor.execute怎么用?Java EventExecutor.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.util.concurrent.EventExecutor的用法示例。


在下文中一共展示了EventExecutor.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unrecoverableErrorOccurred

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public void unrecoverableErrorOccurred(Throwable error, boolean guaranteesBrokenDownstreamResponse) {
    // Cancel request streaming so it stops trying to send data downstream and releases any chunks we've been
    //      holding onto. This holds true no matter the value of guaranteesBrokenDownstreamResponse
    //      (i.e. we want to stop sending data downstream no matter what). Note that this does not stop the
    //      downstream call's response, and that is intentional to support use cases where the downstream
    //      system can still successfully send a full response even though the request wasn't fully sent.
    proxyRouterProcessingState.cancelRequestStreaming(error, ctx);

    setDownstreamCallTimeOnRequestAttributesIfNotAlreadyDone();

    EventExecutor executor = ctx.executor();
    if (executor.inEventLoop()) {
        sendUnrecoverableErrorDownPipeline(error, guaranteesBrokenDownstreamResponse);
    }
    else {
        executor.execute(() -> sendUnrecoverableErrorDownPipeline(error, guaranteesBrokenDownstreamResponse));
    }
}
 
开发者ID:Nike-Inc,项目名称:riposte,代码行数:20,代码来源:ProxyRouterEndpointExecutionHandler.java

示例2: renegotiate

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
/**
 * Performs TLS renegotiation.
 */
public Future<Channel> renegotiate(final Promise<Channel> promise) {
    if (promise == null) {
        throw new NullPointerException("promise");
    }

    ChannelHandlerContext ctx = this.ctx;
    if (ctx == null) {
        throw new IllegalStateException();
    }

    EventExecutor executor = ctx.executor();
    if (!executor.inEventLoop()) {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                handshake(promise);
            }
        });
        return promise;
    }

    handshake(promise);
    return promise;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:28,代码来源:SslHandler.java

示例3: fireChannelRegistered

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireChannelRegistered() {
    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeChannelRegistered();
    } else {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                next.invokeChannelRegistered();
            }
        });
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:17,代码来源:AbstractChannelHandlerContext.java

示例4: fireChannelUnregistered

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireChannelUnregistered() {
    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeChannelUnregistered();
    } else {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                next.invokeChannelUnregistered();
            }
        });
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:17,代码来源:AbstractChannelHandlerContext.java

示例5: fireChannelActive

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireChannelActive() {
    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeChannelActive();
    } else {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                next.invokeChannelActive();
            }
        });
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:17,代码来源:AbstractChannelHandlerContext.java

示例6: fireChannelInactive

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireChannelInactive() {
    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeChannelInactive();
    } else {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                next.invokeChannelInactive();
            }
        });
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:17,代码来源:AbstractChannelHandlerContext.java

示例7: fireUserEventTriggered

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireUserEventTriggered(final Object event) {
    if (event == null) {
        throw new NullPointerException("event");
    }

    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeUserEventTriggered(event);
    } else {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                next.invokeUserEventTriggered(event);
            }
        });
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:21,代码来源:AbstractChannelHandlerContext.java

示例8: fireChannelRead

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireChannelRead(final Object msg) {
    if (msg == null) {
        throw new NullPointerException("msg");
    }

    invokedNextChannelRead = true;
    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeChannelRead(msg);
    } else {
        executor.execute(new OneTimeTask() {
            @Override
            public void run() {
                next.invokeChannelRead(msg);
            }
        });
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:22,代码来源:AbstractChannelHandlerContext.java

示例9: fireChannelWritabilityChanged

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireChannelWritabilityChanged() {
    final AbstractChannelHandlerContext next = findContextInbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeChannelWritabilityChanged();
    } else {
        Runnable task = next.invokeChannelWritableStateChangedTask;
        if (task == null) {
            next.invokeChannelWritableStateChangedTask = task = new Runnable() {
                @Override
                public void run() {
                    next.invokeChannelWritabilityChanged();
                }
            };
        }
        executor.execute(task);
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:21,代码来源:AbstractChannelHandlerContext.java

示例10: read

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext read() {
    invokedPrevRead = true;
    final AbstractChannelHandlerContext next = findContextOutbound();
    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeRead();
    } else {
        Runnable task = next.invokeReadTask;
        if (task == null) {
            next.invokeReadTask = task = new Runnable() {
                @Override
                public void run() {
                    next.invokeRead();
                }
            };
        }
        executor.execute(task);
    }
    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:22,代码来源:AbstractChannelHandlerContext.java

示例11: destroyUp

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
private void destroyUp(AbstractChannelHandlerContext ctx) {
    final Thread currentThread = Thread.currentThread();
    final AbstractChannelHandlerContext tail = this.tail;
    for (;;) {
        if (ctx == tail) {
            destroyDown(currentThread, tail.prev);
            break;
        }

        final EventExecutor executor = ctx.executor();
        if (!executor.inEventLoop(currentThread)) {
            final AbstractChannelHandlerContext finalCtx = ctx;
            executor.execute(new OneTimeTask() {
                @Override
                public void run() {
                    destroyUp(finalCtx);
                }
            });
            break;
        }

        ctx = ctx.next;
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:25,代码来源:DefaultChannelPipeline.java

示例12: close

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelFuture close(final ChannelPromise promise) {
    ChannelHandlerContext ctx = ctx();
    EventExecutor executor = ctx.executor();
    if (executor.inEventLoop()) {
        return finishEncode(ctx, promise);
    } else {
        final ChannelPromise p = ctx.newPromise();
        executor.execute(new Runnable() {
            @Override
            public void run() {
                ChannelFuture f = finishEncode(ctx(), p);
                f.addListener(new ChannelPromiseNotifier(promise));
            }
        });
        return p;
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:19,代码来源:JZlibEncoder.java

示例13: complete

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
protected void complete() {
    EventExecutor executor = channel.eventLoop();
    executor.execute(new Runnable() {
        @Override
        public void run() {
            channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT).addListener(new ChannelFutureListener() {
                @Override
                public void operationComplete(ChannelFuture future) throws Exception {
                    removeFromPipeline();
                }
            });
        }
    });
}
 
开发者ID:amaralDaniel,项目名称:megaphone,代码行数:16,代码来源:NettyReactiveStreamsBody.java

示例14: fireExceptionCaught

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
@Override
public ChannelHandlerContext fireExceptionCaught(final Throwable cause) {
    if (cause == null) {
        throw new NullPointerException("cause");
    }

    final AbstractChannelHandlerContext next = this.next;

    EventExecutor executor = next.executor();
    if (executor.inEventLoop()) {
        next.invokeExceptionCaught(cause);
    } else {
        try {
            executor.execute(new OneTimeTask() {
                @Override
                public void run() {
                    next.invokeExceptionCaught(cause);
                }
            });
        } catch (Throwable t) {
            if (logger.isWarnEnabled()) {
                logger.warn("Failed to submit an exceptionCaught() event.", t);
                logger.warn("The exceptionCaught() event that was failed to submit was:", cause);
            }
        }
    }

    return this;
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:30,代码来源:AbstractChannelHandlerContext.java

示例15: safeExecute

import io.netty.util.concurrent.EventExecutor; //导入方法依赖的package包/类
private static void safeExecute(EventExecutor executor, Runnable runnable, ChannelPromise promise, Object msg) {
    try {
        executor.execute(runnable);
    } catch (Throwable cause) {
        try {
            promise.setFailure(cause);
        } finally {
            if (msg != null) {
                ReferenceCountUtil.release(msg);
            }
        }
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:14,代码来源:AbstractChannelHandlerContext.java


注:本文中的io.netty.util.concurrent.EventExecutor.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。