private EventExecutor childExecutor(EventExecutorGroup group) { if (group == null) { return(null); } Dictionary <EventExecutorGroup, EventExecutor> childExecutors = this.childExecutors; if (childExecutors == null) { // Use size of 4 as most people only use one extra EventExecutor. childExecutors = this.childExecutors = new Dictionary <EventExecutorGroup, EventExecutor>(4); } // Pin one of the child executors once and remember it so that the same child executor // is used to fire events for the same channel. EventExecutor childExecutor; childExecutors.TryGetValue(group, out childExecutor); if (childExecutor == null) { childExecutor = group.next(); childExecutors.Add(group, childExecutor); } return(childExecutor); }
protected SingleThreadEventExecutor(EventExecutorGroup parent, Executor executor, bool addTaskWakesUp, int maxPendingTasks) : base(parent) { this.addTaskWakesUp = addTaskWakesUp; this.maxPendingTasks = Math.Max(16, maxPendingTasks); if (executor == null) { throw new NullReferenceException("executor"); } this.executor = executor; taskQueue = newTaskQueue(this.maxPendingTasks); }
private AbstractChannelHandlerContext newContext(EventExecutorGroup group, String name, ChannelHandler handler) { return(new DefaultChannelHandlerContext(this, childExecutor(group), name, handler)); }
protected AbstractScheduledEventExecutor(EventExecutorGroup parent) : base(parent) { }
private static bool IsShuttingDown(ChannelHandlerContext ctx) { EventExecutorGroup eventLoopGroup = ctx.executor().parent(); return(eventLoopGroup != null && eventLoopGroup.ShuttingDown); }
protected AbstractEventExecutor(EventExecutorGroup parent) { this.parent = parent; }