internal static void Dispatch(NonBlockingConnection conn, ActionBean bean, Protocol protocol) { int priority = 1; Task task = new Task(priority, bean, conn, protocol); ThreadPool.AddTask(task); }
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(); }
public void DispatchAct(Protocol protocol, NonBlockingConnection conn) { ActionBean bean = null; if (actions.TryGetValue(protocol.act, out bean)) { // 分配一个线程执行 Task.Dispatch(conn, bean, protocol); } }
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(); }
private Task(int priority, ActionBean bean, NonBlockingConnection conn, Protocol protocol) : base(priority) { this.bean = bean; this.conn = conn; this.protocol = protocol; }