private void Run() { while (isRun) { if (queue.Count == 0 || isSuspend) { resetEvent.WaitOne(); if (isSuspend) { state = ProcessState.Suspend; } else { state = ProcessState.Waiting; } } else { state = ProcessState.Processing; StateItem item = null; lock (queue) { item = queue.Dequeue(); } try { IProcessDispatcher dispatcher = null; if (context != null) { dispatcher = context.ProcessDispatcher; } else { dispatcher = new DefaultDispatcher(); } StateChanged(item, dispatcher); } catch (Exception e) { Logger.Error(string.Format("{0}³ö´í¡£ÔÒò£º{1}", GetType(), e.Message)); } } } }
private void Run() { while (isRun) { if (queue.Count == 0 || isSuspend) { resetEvent.WaitOne(); if (isSuspend) state = ProcessState.Suspend; else state = ProcessState.Waiting; } else { state = ProcessState.Processing; StateItem item = null; lock (queue) { item = queue.Dequeue(); } try { IProcessDispatcher dispatcher = null; if (context != null) dispatcher = context.ProcessDispatcher; else dispatcher = new DefaultDispatcher(); StateChanged(item, dispatcher); } catch (Exception e) { Logger.Error(string.Format("{0}�����ԭ��{1}", GetType(), e.Message)); } } } }