Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 3
0
 private AbstractChannelHandlerContext newContext(EventExecutorGroup group, String name, ChannelHandler handler)
 {
     return(new DefaultChannelHandlerContext(this, childExecutor(group), name, handler));
 }
Ejemplo n.º 4
0
 protected AbstractScheduledEventExecutor(EventExecutorGroup parent) : base(parent)
 {
 }
Ejemplo n.º 5
0
        private static bool IsShuttingDown(ChannelHandlerContext ctx)
        {
            EventExecutorGroup eventLoopGroup = ctx.executor().parent();

            return(eventLoopGroup != null && eventLoopGroup.ShuttingDown);
        }
Ejemplo n.º 6
0
 protected AbstractEventExecutor(EventExecutorGroup parent)
 {
     this.parent = parent;
 }