static void invokeChannelUnregistered(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelUnregistered(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelUnregistered(); } }); } }
@Override public void onSubscribe(Subscription s) { upstreamSubscription = s; if (processorExecutor.inEventLoop()) { downstreamSubscriptions.forEach(DownstreamSubscription::invokeOnSubscribe); } else { processorExecutor.execute( () -> downstreamSubscriptions.forEach(DownstreamSubscription::invokeOnSubscribe)); } }
static void invokeChannelActive(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelActive(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelActive(); } }); } }
void invokeOnSubscribe() { if (invokedOnSubscribe) { return; } invokedOnSubscribe = true; if (executor.inEventLoop()) { subscriber.onSubscribe(this); } else { executor.execute(() -> subscriber.onSubscribe(this)); } }
static void invokeChannelInactive(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelInactive(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelInactive(); } }); } }
final void remove() { EventExecutor executor = executor(); if (executor.inEventLoop()) { remove0(); } else { executor.execute(new Runnable() { @Override public void run() { remove0(); } }); } }
static void invokeChannelRegistered(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelRegistered(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelRegistered(); } }); } }
void signal() { if (executor.inEventLoop()) { doSignal(); } else { executor.execute(this::doSignal); } }
static void invokeChannelRegistered(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelRegistered(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelRegistered(); } }); } }
void close() { if (processorExecutor.inEventLoop()) { doClose(); } else { processorExecutor.execute(this::doClose); } }
static void invokeChannelInactive(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelInactive(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelInactive(); } }); } }
@Override public void onComplete() { if (executor.inEventLoop()) { onComplete0(); } else { executor.execute(this::onComplete0); } }
static void invokeChannelWritabilityChanged(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelWritabilityChanged(); } else { Tasks tasks = next.invokeTasks; if (tasks == null) { next.invokeTasks = tasks = new Tasks(next); } executor.execute(tasks.invokeChannelWritableStateChangedTask); } }
final void remove() { EventExecutor executor = executor(); if (executor.inEventLoop()) { remove0(); } else { executor.execute(new Runnable() { @Override public void run() { remove0(); } }); } }
static void invokeChannelUnregistered(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelUnregistered(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelUnregistered(); } }); } }
@Override public Future<Channel> acquire(final Promise<Channel> promise) { try { if (executor.inEventLoop()) { acquire0(promise); } else { executor.execute(new Runnable() { @Override public void run() { acquire0(promise); } }); } } catch (Throwable cause) { promise.setFailure(cause); } return promise; }
static void invokeChannelActive(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelActive(); } else { executor.execute(new Runnable() { @Override public void run() { next.invokeChannelActive(); } }); } }
void writePriority(Http2Stream stream, int streamDependency, short weight, boolean exclusive) { EventExecutor executor = chctx.executor(); if (executor.inEventLoop()) { _writePriority(stream, streamDependency, weight, exclusive); } else { executor.execute(() -> { _writePriority(stream, streamDependency, weight, exclusive); }); } } }
static void invokeChannelReadComplete(final AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelReadComplete(); } else { Tasks tasks = next.invokeTasks; if (tasks == null) { next.invokeTasks = tasks = new Tasks(next); } executor.execute(tasks.invokeChannelReadCompleteTask); } }
private void doResolveAllUncached(final String hostname, final DnsRecord[] additionals, final Promise<List<InetAddress>> promise, final DnsCache resolveCache) { // Call doResolveUncached0(...) in the EventLoop as we may need to submit multiple queries which would need // to submit multiple Runnable at the end if we are not already on the EventLoop. EventExecutor executor = executor(); if (executor.inEventLoop()) { doResolveAllUncached0(hostname, additionals, promise, resolveCache); } else { executor.execute(new Runnable() { @Override public void run() { doResolveAllUncached0(hostname, additionals, promise, resolveCache); } }); } }