示例#1
0
        private void ProcessThreadWorkQueueFront(DualWorkQueue <object> queues)
        {
            Object item;

            while ((item = queues.FrontQueue.Poll()) != null)
            {
                if (item is InsertIntoLatchSpin)
                {
                    ProcessThreadWorkQueueLatchedSpin((InsertIntoLatchSpin)item);
                }
                else if (item is InsertIntoLatchWait)
                {
                    ProcessThreadWorkQueueLatchedWait((InsertIntoLatchWait)item);
                }
                else
                {
                    ProcessThreadWorkQueueUnlatched(item);
                }

                bool haveDispatched = _unisolatedServices.NamedWindowDispatchService.Dispatch();
                if (haveDispatched)
                {
                    Dispatch();
                }
            }
        }
示例#2
0
        /// <summary>Works off the thread's work queue. </summary>
        public void ProcessThreadWorkQueue()
        {
            DualWorkQueue <Object> queues = _threadWorkQueue.ThreadQueue;

            Object item;

            if (queues.FrontQueue.IsEmpty())
            {
                bool haveDispatched = _unisolatedServices.NamedWindowDispatchService.Dispatch();
                if (haveDispatched)
                {
                    // Dispatch results to listeners
                    Dispatch();
                    if (!queues.FrontQueue.IsEmpty())
                    {
                        ProcessThreadWorkQueueFront(queues);
                    }
                }
            }
            else
            {
                ProcessThreadWorkQueueFront(queues);
            }

            while ((item = queues.BackQueue.Poll()) != null)
            {
                if (item is InsertIntoLatchSpin)
                {
                    ProcessThreadWorkQueueLatchedSpin((InsertIntoLatchSpin)item);
                }
                else if (item is InsertIntoLatchWait)
                {
                    ProcessThreadWorkQueueLatchedWait((InsertIntoLatchWait)item);
                }
                else
                {
                    ProcessThreadWorkQueueUnlatched(item);
                }

                bool haveDispatched = _unisolatedServices.NamedWindowDispatchService.Dispatch();
                if (haveDispatched)
                {
                    Dispatch();
                }

                if (!queues.FrontQueue.IsEmpty())
                {
                    ProcessThreadWorkQueueFront(queues);
                }
            }
        }
示例#3
0
 public EPEventServiceThreadLocalEntry(
     DualWorkQueue<object> dualWorkQueue,
     ArrayBackedCollection<FilterHandle> matchesArrayThreadLocal,
     ArrayBackedCollection<ScheduleHandle> scheduleArrayThreadLocal,
     IDictionary<EPStatementAgentInstanceHandle, object> matchesPerStmtThreadLocal,
     IDictionary<EPStatementAgentInstanceHandle, object> schedulePerStmtThreadLocal,
     ExprEvaluatorContext exprEvaluatorContext)
 {
     DualWorkQueue = dualWorkQueue;
     MatchesArrayThreadLocal = matchesArrayThreadLocal;
     ScheduleArrayThreadLocal = scheduleArrayThreadLocal;
     MatchesPerStmtThreadLocal = matchesPerStmtThreadLocal;
     SchedulePerStmtThreadLocal = schedulePerStmtThreadLocal;
     ExprEvaluatorContext = exprEvaluatorContext;
 }
示例#4
0
        public static IThreadLocal <EPEventServiceThreadLocalEntry> AllocateThreadLocals(
            bool isPrioritized,
            string runtimeURI,
            EventBeanService eventBeanService,
            ExceptionHandlingService exceptionHandlingService,
            SchedulingService schedulingService)
        {
            return(new FastThreadLocal <EPEventServiceThreadLocalEntry>(
                       () => {
                DualWorkQueue <object> dualWorkQueue = new DualWorkQueue <object>();
                ArrayBackedCollection <FilterHandle> filterHandles = new ArrayBackedCollection <FilterHandle>(100);
                ArrayBackedCollection <ScheduleHandle> scheduleHandles = new ArrayBackedCollection <ScheduleHandle>(100);

                IDictionary <EPStatementAgentInstanceHandle, object> matchesPerStmt;
                IDictionary <EPStatementAgentInstanceHandle, object> schedulesPerStmt;
                if (isPrioritized)
                {
                    matchesPerStmt = new SortedDictionary <EPStatementAgentInstanceHandle, object>(EPStatementAgentInstanceHandleComparer.INSTANCE);
                    schedulesPerStmt = new SortedDictionary <EPStatementAgentInstanceHandle, object>(EPStatementAgentInstanceHandleComparer.INSTANCE);
                }
                else
                {
                    matchesPerStmt = new Dictionary <EPStatementAgentInstanceHandle, object>();
                    schedulesPerStmt = new Dictionary <EPStatementAgentInstanceHandle, object>();
                }

                ExprEvaluatorContext runtimeFilterAndDispatchTimeContext = new EPEventServiceExprEvaluatorContext(
                    runtimeURI,
                    eventBeanService,
                    exceptionHandlingService,
                    schedulingService);
                return new EPEventServiceThreadLocalEntry(
                    dualWorkQueue,
                    filterHandles,
                    scheduleHandles,
                    matchesPerStmt,
                    schedulesPerStmt,
                    runtimeFilterAndDispatchTimeContext);
            }));
        }