Exemplo n.º 1
0
        /// <summary>Process a single match. </summary>
        /// <param name="handle">statement</param>
        /// <param name="handleCallback">callback</param>
        /// <param name="theEvent">event to indicate</param>
        public void ProcessStatementFilterSingle(EPStatementAgentInstanceHandle handle, EPStatementHandleCallback handleCallback, EventBean theEvent)
        {
            using (handle.StatementAgentInstanceLock.AcquireWriteLock())
            {
                try
                {
                    if (handle.HasVariables)
                    {
                        _unisolatedServices.VariableService.SetLocalVersion();
                    }

                    handleCallback.FilterCallback.MatchFound(theEvent, null);

                    // internal join processing, if applicable
                    handle.InternalDispatch();
                }
                catch (Exception ex)
                {
                    _unisolatedServices.ExceptionHandlingService.HandleException(ex, handle, ExceptionHandlerExceptionType.PROCESS, theEvent);
                }
                finally
                {
                    if (handle.HasTableAccess)
                    {
                        _unisolatedServices.TableService.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>Processing multiple filter matches for a statement. </summary>
        /// <param name="handle">statement handle</param>
        /// <param name="callbackList">object containing callbacks</param>
        /// <param name="theEvent">to process</param>
        public void ProcessStatementFilterMultiple(EPStatementAgentInstanceHandle handle, ICollection <FilterHandleCallback> callbackList, EventBean theEvent)
        {
            using (handle.StatementAgentInstanceLock.AcquireWriteLock())
            {
                try
                {
                    if (handle.HasVariables)
                    {
                        _unisolatedServices.VariableService.SetLocalVersion();
                    }

                    handle.MultiMatchHandler.Handle(callbackList, theEvent);

                    // internal join processing, if applicable
                    handle.InternalDispatch();
                }
                catch (Exception ex)
                {
                    _unisolatedServices.ExceptionHandlingService.HandleException(ex, handle);
                }
                finally
                {
                    if (handle.HasTableAccess)
                    {
                        _unisolatedServices.TableService.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Processing multiple schedule matches for a statement.
        /// </summary>
        /// <param name="handle">statement handle</param>
        /// <param name="callbackObject">object containing matches</param>
        /// <param name="services">runtime services</param>
        public static void ProcessStatementScheduleMultiple(
            EPStatementAgentInstanceHandle handle,
            object callbackObject,
            EPServicesEvaluation services)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QTimeCP(handle, services.SchedulingService.Time);
            }

            handle.StatementAgentInstanceLock.AcquireWriteLock();
            try {
                if (!handle.IsDestroyed)
                {
                    if (handle.HasVariables)
                    {
                        services.VariableManagementService.SetLocalVersion();
                    }

                    if (callbackObject is ArrayDeque <ScheduleHandleCallback> )
                    {
                        ArrayDeque <ScheduleHandleCallback> callbackList = (ArrayDeque <ScheduleHandleCallback>)callbackObject;
                        foreach (ScheduleHandleCallback callback in callbackList)
                        {
                            callback.ScheduledTrigger();
                        }
                    }
                    else
                    {
                        ScheduleHandleCallback callback = (ScheduleHandleCallback)callbackObject;
                        callback.ScheduledTrigger();
                    }

                    // internal join processing, if applicable
                    handle.InternalDispatch();
                }
            }
            catch (Exception ex) {
                services.ExceptionHandlingService.HandleException(ex, handle, ExceptionHandlerExceptionType.PROCESS, null);
            }
            finally {
                if (handle.HasTableAccess)
                {
                    services.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                }

                handle.StatementAgentInstanceLock.ReleaseWriteLock();

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().ATimeCP();
                }
            }
        }
Exemplo n.º 4
0
        private void ProcessHandleMultiple(EPStatementAgentInstanceHandle handle, IDictionary <NamedWindowConsumerView, NamedWindowDeltaData> deltaPerConsumer)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QNamedWindowCPMulti(_exceptionHandlingService.EngineURI, deltaPerConsumer, handle, _schedulingService.Time);
            }

            try
            {
                using (handle.StatementAgentInstanceLock.AcquireWriteLock())
                {
                    try
                    {
                        if (handle.HasVariables)
                        {
                            _variableService.SetLocalVersion();
                        }
                        foreach (var entryDelta in deltaPerConsumer)
                        {
                            var newData = entryDelta.Value.NewData;
                            var oldData = entryDelta.Value.OldData;
                            entryDelta.Key.Update(newData, oldData);
                        }

                        // internal join processing, if applicable
                        handle.InternalDispatch();
                    }
                    catch (Exception ex)
                    {
                        _exceptionHandlingService.HandleException(ex, handle, ExceptionHandlerExceptionType.PROCESS);
                    }
                    finally
                    {
                        if (handle.HasTableAccess)
                        {
                            _tableService.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                        }
                    }
                }
            }
            finally
            {
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().ANamedWindowCPMulti();
                }
            }
        }
Exemplo n.º 5
0
        private void ProcessHandle(EPStatementAgentInstanceHandle handle, IList <NamedWindowConsumerView> value, EventBean[] newData, EventBean[] oldData)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QNamedWindowCPSingle(_exceptionHandlingService.EngineURI, value, newData, oldData, handle, _schedulingService.Time);
            }

            try
            {
                using (handle.StatementAgentInstanceLock.AcquireWriteLock())
                {
                    try
                    {
                        if (handle.HasVariables)
                        {
                            _variableService.SetLocalVersion();
                        }

                        foreach (var consumerView in value)
                        {
                            consumerView.Update(newData, oldData);
                        }

                        // internal join processing, if applicable
                        handle.InternalDispatch();
                    }
                    catch (Exception ex)
                    {
                        _exceptionHandlingService.HandleException(ex, handle, ExceptionHandlerExceptionType.PROCESS);
                    }
                    finally
                    {
                        if (handle.HasTableAccess)
                        {
                            _tableService.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                        }
                    }
                }
            }
            finally
            {
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().ANamedWindowCPSingle();
                }
            }
        }