Пример #1
0
        public void ScheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QPatternObserverScheduledEval();
            }

            // compute reschedule time
            _isTimerActive = false;
            var schedulingService = _observerEventEvaluator.Context.PatternContext.SchedulingService;
            var nextScheduledTime = ComputeNextSetLastScheduled(schedulingService.Time);

            var quit = !_isFilterChildNonQuitting || nextScheduledTime == -1;

            _observerEventEvaluator.ObserverEvaluateTrue(_beginState, quit);

            // handle no more invocations planned
            if (nextScheduledTime == -1)
            {
                StopObserve();
                _observerEventEvaluator.ObserverEvaluateFalse(false);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().APatternObserverScheduledEval();
                }
                return;
            }

            schedulingService.Add(nextScheduledTime, _scheduleHandle, _scheduleSlot);
            _isTimerActive = true;
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().APatternObserverScheduledEval();
            }
        }
Пример #2
0
 public StatementContextEngineServices(
     IContainer container,
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowMgmtService namedWindowMgmtService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory,
     ContextManagementService contextManagementService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     EventTableIndexService eventTableIndexService,
     PatternNodeFactory patternNodeFactory,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     TimeSourceService timeSourceService,
     EngineImportService engineImportService,
     AggregationFactoryFactory aggregationFactoryFactory,
     SchedulingService schedulingService,
     ExprDeclaredService exprDeclaredService)
 {
     Container                           = container;
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowMgmtService              = namedWindowMgmtService;
     VariableService                     = variableService;
     TableService                        = tableService;
     EngineSettingsService               = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
     ContextManagementService            = contextManagementService;
     ViewServicePreviousFactory          = viewServicePreviousFactory;
     EventTableIndexService              = eventTableIndexService;
     PatternNodeFactory                  = patternNodeFactory;
     FilterBooleanExpressionFactory      = filterBooleanExpressionFactory;
     TimeSourceService                   = timeSourceService;
     EngineImportService                 = engineImportService;
     AggregationFactoryFactory           = aggregationFactoryFactory;
     SchedulingService                   = schedulingService;
     ExprDeclaredService                 = exprDeclaredService;
 }
Пример #3
0
 public void ScheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
 {
     if (InstrumentationHelper.ENABLED)
     {
         InstrumentationHelper.Get().QPatternObserverScheduledEval();
     }
     _observerEventEvaluator.ObserverEvaluateTrue(_beginState, true);
     _isTimerActive = false;
     if (InstrumentationHelper.ENABLED)
     {
         InstrumentationHelper.Get().APatternObserverScheduledEval();
     }
 }
Пример #4
0
 public void ScheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
 {
     if (InstrumentationHelper.ENABLED)
     {
         InstrumentationHelper.Get().QPatternGuardScheduledEval();
     }
     // Timer callback is automatically removed when triggering
     isTimerActive = false;
     quitable.GuardQuit();
     if (InstrumentationHelper.ENABLED)
     {
         InstrumentationHelper.Get().APatternGuardScheduledEval();
     }
 }
Пример #5
0
        public void ScheduledTrigger(EngineLevelExtensionServicesContext extensionServicesContext)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QHistoricalScheduledEval();
            }
            // purge expired
            var now = _schedulingService.Time;

            _cache.Where(entry => MaxAgeMSec < (now - entry.Value.Time))
            .Select(entry => entry.Key)
            .ToList()
            .ForEach(key => _cache.Remove(key));

            _isScheduled = false;
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AHistoricalScheduledEval();
            }
        }
Пример #6
0
        public void ScheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QHistoricalScheduledEval();
            }
            // purge expired
            var now        = _schedulingService.Time;
            var maxAgeMSec = _timeAbacus.DeltaForSecondsDouble(_maxAgeSec);

            _cache
            .Where(entry => ((now - entry.Value.Time) > maxAgeMSec))
            .Select(entry => entry.Key)
            .ToList()
            .ForEach(itemKey => _cache.Remove(itemKey));

            _isScheduled = false;
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AHistoricalScheduledEval();
            }
        }
Пример #7
0
 public StatementContextEngineServices(
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowService namedWindowService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory)
 {
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowService                  = namedWindowService;
     VariableService                     = variableService;
     TableService                        = tableService;
     _engineSettingsService              = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
 }
Пример #8
0
 public void ScheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
 {
     log.Debug(".scheduledTrigger");
     _orderAllCallbacks++;
     _orderTriggered = _orderAllCallbacks;
 }
Пример #9
0
 /// <summary>Dispose services. </summary>
 public void Dispose()
 {
     if (ScriptingService != null)
     {
         ScriptingService.Dispose();
     }
     if (ExprDeclaredService != null)
     {
         ExprDeclaredService.Dispose();
     }
     if (DataFlowService != null)
     {
         DataFlowService.Dispose();
     }
     if (VariableService != null)
     {
         VariableService.Dispose();
     }
     if (MetricsReportingService != null)
     {
         MetricsReportingService.Dispose();
     }
     if (ThreadingService != null)
     {
         ThreadingService.Dispose();
     }
     if (StatementLifecycleSvc != null)
     {
         StatementLifecycleSvc.Dispose();
     }
     if (FilterService != null)
     {
         FilterService.Dispose();
     }
     if (SchedulingService != null)
     {
         SchedulingService.Dispose();
     }
     if (SchedulingMgmtService != null)
     {
         SchedulingMgmtService.Dispose();
     }
     if (StreamService != null)
     {
         StreamService.Destroy();
     }
     if (NamedWindowMgmtService != null)
     {
         NamedWindowMgmtService.Dispose();
     }
     if (NamedWindowDispatchService != null)
     {
         NamedWindowDispatchService.Dispose();
     }
     if (EngineLevelExtensionServicesContext != null)
     {
         EngineLevelExtensionServicesContext.Dispose();
     }
     if (StatementIsolationService != null)
     {
         StatementIsolationService.Dispose();
     }
     if (DeploymentStateService != null)
     {
         DeploymentStateService.Dispose();
     }
 }
Пример #10
0
        // Supplied after construction to avoid circular dependency

        /// <summary>
        /// Constructor - sets up new set of services.
        /// </summary>
        /// <param name="engineURI">is the engine URI</param>
        /// <param name="schedulingService">service to get time and schedule callbacks</param>
        /// <param name="eventAdapterService">service to resolve event types</param>
        /// <param name="engineImportService">is engine imported static func packages and aggregation functions</param>
        /// <param name="engineSettingsService">provides engine settings</param>
        /// <param name="databaseConfigService">service to resolve a database name to database connection factory and configs</param>
        /// <param name="plugInViews">resolves view namespace and name to view factory class</param>
        /// <param name="statementLockFactory">creates statement-level locks</param>
        /// <param name="eventProcessingRWLock">is the engine lock for statement management</param>
        /// <param name="extensionServicesContext">marker interface allows adding additional services</param>
        /// <param name="engineEnvContext">is engine environment/directory information for use with adapters and external env</param>
        /// <param name="statementContextFactory">is the factory to use to create statement context objects</param>
        /// <param name="plugInPatternObjects">resolves plug-in pattern objects</param>
        /// <param name="timerService">is the timer service</param>
        /// <param name="filterService">the filter service</param>
        /// <param name="streamFactoryService">is hooking up filters to streams</param>
        /// <param name="namedWindowMgmtService">The named window MGMT service.</param>
        /// <param name="namedWindowDispatchService">The named window dispatch service.</param>
        /// <param name="variableService">provides access to variable values</param>
        /// <param name="tableService">The table service.</param>
        /// <param name="timeSourceService">time source provider class</param>
        /// <param name="valueAddEventService">handles Update events</param>
        /// <param name="metricsReportingService">for metric reporting</param>
        /// <param name="statementEventTypeRef">statement to event type reference holding</param>
        /// <param name="statementVariableRef">statement to variabke reference holding</param>
        /// <param name="configSnapshot">configuration snapshot</param>
        /// <param name="threadingServiceImpl">engine-level threading services</param>
        /// <param name="internalEventRouter">routing of events</param>
        /// <param name="statementIsolationService">maintains isolation information per statement</param>
        /// <param name="schedulingMgmtService">schedule management for statements</param>
        /// <param name="deploymentStateService">The deployment state service.</param>
        /// <param name="exceptionHandlingService">The exception handling service.</param>
        /// <param name="patternNodeFactory">The pattern node factory.</param>
        /// <param name="eventTypeIdGenerator">The event type id generator.</param>
        /// <param name="statementMetadataFactory">The statement metadata factory.</param>
        /// <param name="contextManagementService">The context management service.</param>
        /// <param name="patternSubexpressionPoolSvc">The pattern subexpression pool SVC.</param>
        /// <param name="matchRecognizeStatePoolEngineSvc">The match recognize state pool engine SVC.</param>
        /// <param name="dataFlowService">The data flow service.</param>
        /// <param name="exprDeclaredService">The expr declared service.</param>
        /// <param name="contextControllerFactoryFactorySvc">The context controller factory factory SVC.</param>
        /// <param name="contextManagerFactoryService">The context manager factory service.</param>
        /// <param name="epStatementFactory">The ep statement factory.</param>
        /// <param name="regexHandlerFactory">The regex handler factory.</param>
        /// <param name="viewableActivatorFactory">The viewable activator factory.</param>
        /// <param name="filterNonPropertyRegisteryService">The filter non property registery service.</param>
        /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
        /// <param name="viewServicePreviousFactory">The view service previous factory.</param>
        /// <param name="eventTableIndexService">The event table index service.</param>
        /// <param name="epRuntimeIsolatedFactory">The ep runtime isolated factory.</param>
        /// <param name="filterBooleanExpressionFactory">The filter boolean expression factory.</param>
        /// <param name="dataCacheFactory">The data cache factory.</param>
        /// <param name="multiMatchHandlerFactory">The multi match handler factory.</param>
        /// <param name="namedWindowConsumerMgmtService">The named window consumer MGMT service.</param>
        /// <param name="aggregationFactoryFactory"></param>
        /// <param name="scriptingService">The scripting service.</param>
        public EPServicesContext(
            string engineURI,
            SchedulingServiceSPI schedulingService,
            EventAdapterService eventAdapterService,
            EngineImportService engineImportService,
            EngineSettingsService engineSettingsService,
            DatabaseConfigService databaseConfigService,
            PluggableObjectCollection plugInViews,
            StatementLockFactory statementLockFactory,
            IReaderWriterLock eventProcessingRWLock,
            EngineLevelExtensionServicesContext extensionServicesContext,
            Directory engineEnvContext,
            StatementContextFactory statementContextFactory,
            PluggableObjectCollection plugInPatternObjects,
            TimerService timerService,
            FilterServiceSPI filterService,
            StreamFactoryService streamFactoryService,
            NamedWindowMgmtService namedWindowMgmtService,
            NamedWindowDispatchService namedWindowDispatchService,
            VariableService variableService,
            TableService tableService,
            TimeSourceService timeSourceService,
            ValueAddEventService valueAddEventService,
            MetricReportingServiceSPI metricsReportingService,
            StatementEventTypeRef statementEventTypeRef,
            StatementVariableRef statementVariableRef,
            ConfigurationInformation configSnapshot,
            ThreadingService threadingServiceImpl,
            InternalEventRouterImpl internalEventRouter,
            StatementIsolationService statementIsolationService,
            SchedulingMgmtService schedulingMgmtService,
            DeploymentStateService deploymentStateService,
            ExceptionHandlingService exceptionHandlingService,
            PatternNodeFactory patternNodeFactory,
            EventTypeIdGenerator eventTypeIdGenerator,
            StatementMetadataFactory statementMetadataFactory,
            ContextManagementService contextManagementService,
            PatternSubexpressionPoolEngineSvc patternSubexpressionPoolSvc,
            MatchRecognizeStatePoolEngineSvc matchRecognizeStatePoolEngineSvc,
            DataFlowService dataFlowService,
            ExprDeclaredService exprDeclaredService,
            ContextControllerFactoryFactorySvc contextControllerFactoryFactorySvc,
            ContextManagerFactoryService contextManagerFactoryService,
            EPStatementFactory epStatementFactory,
            RegexHandlerFactory regexHandlerFactory,
            ViewableActivatorFactory viewableActivatorFactory,
            FilterNonPropertyRegisteryService filterNonPropertyRegisteryService,
            ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
            ViewServicePreviousFactory viewServicePreviousFactory,
            EventTableIndexService eventTableIndexService,
            EPRuntimeIsolatedFactory epRuntimeIsolatedFactory,
            FilterBooleanExpressionFactory filterBooleanExpressionFactory,
            DataCacheFactory dataCacheFactory,
            MultiMatchHandlerFactory multiMatchHandlerFactory,
            NamedWindowConsumerMgmtService namedWindowConsumerMgmtService,
            AggregationFactoryFactory aggregationFactoryFactory,
            ScriptingService scriptingService)
        {
            EngineURI             = engineURI;
            SchedulingService     = schedulingService;
            EventAdapterService   = eventAdapterService;
            EngineImportService   = engineImportService;
            EngineSettingsService = engineSettingsService;
            DatabaseRefService    = databaseConfigService;
            FilterService         = filterService;
            TimerService          = timerService;
            DispatchService       = DispatchServiceProvider.NewService();
            ViewService           = ViewServiceProvider.NewService();
            StreamService         = streamFactoryService;
            PlugInViews           = plugInViews;
            StatementLockFactory  = statementLockFactory;
            EventProcessingRWLock = eventProcessingRWLock;
            EngineLevelExtensionServicesContext = extensionServicesContext;
            EngineEnvContext           = engineEnvContext;
            StatementContextFactory    = statementContextFactory;
            PlugInPatternObjects       = plugInPatternObjects;
            NamedWindowMgmtService     = namedWindowMgmtService;
            NamedWindowDispatchService = namedWindowDispatchService;
            VariableService            = variableService;
            TableService                     = tableService;
            TimeSource                       = timeSourceService;
            ValueAddEventService             = valueAddEventService;
            MetricsReportingService          = metricsReportingService;
            StatementEventTypeRefService     = statementEventTypeRef;
            ConfigSnapshot                   = configSnapshot;
            ThreadingService                 = threadingServiceImpl;
            InternalEventRouter              = internalEventRouter;
            StatementIsolationService        = statementIsolationService;
            SchedulingMgmtService            = schedulingMgmtService;
            StatementVariableRefService      = statementVariableRef;
            DeploymentStateService           = deploymentStateService;
            ExceptionHandlingService         = exceptionHandlingService;
            PatternNodeFactory               = patternNodeFactory;
            EventTypeIdGenerator             = eventTypeIdGenerator;
            StatementMetadataFactory         = statementMetadataFactory;
            ContextManagementService         = contextManagementService;
            PatternSubexpressionPoolSvc      = patternSubexpressionPoolSvc;
            MatchRecognizeStatePoolEngineSvc = matchRecognizeStatePoolEngineSvc;
            DataFlowService                  = dataFlowService;
            ExprDeclaredService              = exprDeclaredService;
            ExpressionResultCacheSharable    = new ExpressionResultCacheService(
                configSnapshot.EngineDefaults.ExecutionConfig.DeclaredExprValueCacheSize);
            ContextControllerFactoryFactorySvc = contextControllerFactoryFactorySvc;
            ContextManagerFactoryService       = contextManagerFactoryService;
            EpStatementFactory                = epStatementFactory;
            RegexHandlerFactory               = regexHandlerFactory;
            ViewableActivatorFactory          = viewableActivatorFactory;
            FilterNonPropertyRegisteryService = filterNonPropertyRegisteryService;
            ResultSetProcessorHelperFactory   = resultSetProcessorHelperFactory;
            ViewServicePreviousFactory        = viewServicePreviousFactory;
            EventTableIndexService            = eventTableIndexService;
            EpRuntimeIsolatedFactory          = epRuntimeIsolatedFactory;
            FilterBooleanExpressionFactory    = filterBooleanExpressionFactory;
            DataCacheFactory               = dataCacheFactory;
            MultiMatchHandlerFactory       = multiMatchHandlerFactory;
            NamedWindowConsumerMgmtService = namedWindowConsumerMgmtService;
            AggregationFactoryFactory      = aggregationFactoryFactory;
            ScriptingService               = scriptingService;
        }
Пример #11
0
 /// <summary>
 /// Callback that is invoked as indicated by a schedule added to the scheduling service.
 /// </summary>
 /// <param name="engineLevelExtensionServicesContext"></param>
 public void ScheduledTrigger(EngineLevelExtensionServicesContext engineLevelExtensionServicesContext)
 {
     ProcScheduledTrigger(engineLevelExtensionServicesContext);
 }