コード例 #1
0
            internal static void Dispatch(NonBlockingConnection conn, ActionBean bean, Protocol protocol)
            {
                int  priority = 1;
                Task task     = new Task(priority, bean, conn, protocol);

                ThreadPool.AddTask(task);
            }
コード例 #2
0
ファイル: Dispatch.cs プロジェクト: mengtest/DragonBallNew
            private Task(int priority, ActionBean bean, NonBlockingConnection conn, Protocol protocol) : base(priority)
            {
                this.bean     = bean;
                this.conn     = conn;
                this.protocol = protocol;

                time_start = WatchDog.GetTime();
            }
コード例 #3
0
        public void DispatchAct(Protocol protocol, NonBlockingConnection conn)
        {
            ActionBean bean = null;

            if (actions.TryGetValue(protocol.act, out bean))
            {
                // 分配一个线程执行
                Task.Dispatch(conn, bean, protocol);
            }
        }
コード例 #4
0
        private Dispatch()
        {
            // 加载所有的Action
            try{
                AllActClass aac = new AllActClass();
                foreach (IAction act in aac.dic.Values)
                {
                    MethodInfo[] ms = act.GetType().GetMethods();
                    foreach (MethodInfo m in ms)
                    {
                        ActionBean bean = ActionBean.newInstance(act, m);
                        if ((bean != null) && (!actions.ContainsKey(bean.actId)))
                        {
                            actions.Add(bean.actId, bean);
                        }
                    }
                }
            } catch (Exception e) {
                ConsoleEx.DebugLog(e.ToString());
            }

            // 初始化线程池
            ThreadPool.LoadConfig();
        }
コード例 #5
0
 private Task(int priority, ActionBean bean, NonBlockingConnection conn, Protocol protocol) : base(priority)
 {
     this.bean     = bean;
     this.conn     = conn;
     this.protocol = protocol;
 }