private AbstractChannelHandlerContext remove(AbstractChannelHandlerContext ctx) { Debug.Assert(ctx != this.head && ctx != this.tail); lock (this) { remove0(ctx); if (!registered) { callHandlerCallbackLater(ctx, false); return(ctx); } EventExecutor executor = ctx.executor(); if (!executor.inEventLoop()) { executor.execute(() => callHandlerRemoved0(ctx)); return(ctx); } } callHandlerRemoved0(ctx); return(ctx); }
public static void invokeChannelWritabilityChanged(AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelWritabilityChanged(); } else { executor.execute(() => next.invokeChannelWritabilityChanged()); } }
public static void invokeChannelReadComplete(AbstractChannelHandlerContext next) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelReadComplete(); } else { executor.execute(() => next.invokeChannelReadComplete()); } }
public static void invokeUserEventTriggered(AbstractChannelHandlerContext next, Object _event) { Debug.Assert(_event != null); EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeUserEventTriggered(_event); } else { executor.execute(() => next.invokeUserEventTriggered(_event)); } }
public static void invokeChannelRead(AbstractChannelHandlerContext next, Object msg) { Debug.Assert(msg != null); Object m = next._pipeline.touch(msg, next); EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeChannelRead(m); } else { executor.execute(() => next.invokeChannelRead(m)); } }
private static void safeExecute(EventExecutor executor, Action runnable, Object msg) { try { executor.execute(runnable); } catch (Exception /* cause*/) { // try // { // promise.setFailure(cause); // } // finally // { // if (msg != null) // { // ReferenceCountUtil.release(msg); // } // } } }
public static void invokeExceptionCaught(AbstractChannelHandlerContext next, Exception cause) { EventExecutor executor = next.executor(); if (executor.inEventLoop()) { next.invokeExceptionCaught(cause); } else { try { executor.execute(() => next.invokeExceptionCaught(cause)); } catch (Exception t) { if (logger.IsWarnEnabled) { logger.Warn(t, "Failed to submit an exceptionCaught() event."); logger.Warn(cause, "The exceptionCaught() event that was failed to submit was:"); } } } }