예제 #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 void StartObserve()
 {
     var file = new FileInfo(filename);
     if (file.Exists) {
         observerEventEvaluator.ObserverEvaluateTrue(BeginState, true);
     }
     else {
         observerEventEvaluator.ObserverEvaluateFalse(true);
     }
 }
예제 #3
0
 public void StartObserve()
 {
     if (File.Exists(_filename))
     {
         _observerEventEvaluator.ObserverEvaluateTrue(_beginState, true);
     }
     else
     {
         _observerEventEvaluator.ObserverEvaluateFalse(true);
     }
 }
예제 #4
0
        public void StartObserve()
        {
            if (isTimerActive) {
                throw new IllegalStateException("Timer already active");
            }

            var agentInstanceContext = observerEventEvaluator.Context.AgentInstanceContext;
            var schedulingService = agentInstanceContext.SchedulingService;
            var timeAbacus = agentInstanceContext.ImportServiceRuntime.TimeAbacus;

            if (anchorTime == null) {
                if (spec.OptionalDate == null) {
                    anchorTime = DateTimeEx.GetInstance(
                        observerEventEvaluator.Context.StatementContext.ImportServiceRuntime.TimeZone);
                    anchorRemainder = timeAbacus.DateTimeSet(schedulingService.Time, anchorTime);
                }
                else {
                    anchorTime = spec.OptionalDate;
                    anchorRemainder = spec.OptionalRemainder.GetValueOrDefault(0);
                }
            }

            var nextScheduledTime = ComputeNextSetLastScheduled(schedulingService.Time, timeAbacus);
            if (nextScheduledTime == -1) {
                StopObserve();
                observerEventEvaluator.ObserverEvaluateFalse(false);
                return;
            }

            scheduleHandle = new EPStatementHandleCallbackSchedule(
                observerEventEvaluator.Context.AgentInstanceContext.EpStatementAgentInstanceHandle,
                this);
            agentInstanceContext.AuditProvider.ScheduleAdd(
                nextScheduledTime,
                agentInstanceContext,
                scheduleHandle,
                ScheduleObjectType.context,
                NAME_AUDITPROVIDER_SCHEDULE);
            schedulingService.Add(nextScheduledTime, scheduleHandle, scheduleSlot);
            isTimerActive = true;
        }