private void ScheduleCallback() { isCallbackScheduled = true; ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { context.InstrumentationProvider.QOutputRateConditionScheduledEval(); context.AuditProvider.ScheduleFire( context, ScheduleObjectType.outputratelimiting, NAME_AUDITPROVIDER_SCHEDULE); isCallbackScheduled = false; outputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); context.InstrumentationProvider.AOutputRateConditionScheduledEval(); } }; var handle = new EPStatementHandleCallbackSchedule(context.EpStatementAgentInstanceHandle, callback); var schedulingService = context.StatementContext.SchedulingService; var classpathImportService = context.StatementContext.ImportServiceRuntime; long nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance( scheduleSpec, schedulingService.Time, classpathImportService.TimeZone, classpathImportService.TimeAbacus); context.AuditProvider.ScheduleAdd( nextScheduledTime, context, handle, ScheduleObjectType.outputratelimiting, NAME_AUDITPROVIDER_SCHEDULE); schedulingService.Add(nextScheduledTime, handle, scheduleSlot); }
private void ScheduleNextCallback() { var nextScheduleCallback = new ProxyScheduleHandleCallback(delegate { ContinueSendingEvents(); }); var spi = (EPServiceProviderSPI)_epService; var metricsHandle = spi.MetricReportingService.GetStatementHandle(-1, "AbstractCoordinatedAdapter"); var lockImpl = ReaderWriterLockManager.CreateLock("CSV"); var stmtHandle = new EPStatementHandle(-1, "AbstractCoordinatedAdapter", null, StatementType.ESPERIO, "AbstractCoordinatedAdapter", false, metricsHandle, 0, false, false, spi.ServicesContext.MultiMatchHandlerFactory.GetDefaultHandler()); var agentInstanceHandle = new EPStatementAgentInstanceHandle(stmtHandle, lockImpl, -1, new StatementAgentInstanceFilterVersion(), null); var scheduleCSVHandle = new EPStatementHandleCallback(agentInstanceHandle, nextScheduleCallback); ScheduleSlot nextScheduleSlot; if (EventsToSend.IsEmpty()) { if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleNextCallback no events to send, scheduling callback in 100 ms"); } nextScheduleSlot = new ScheduleSlot(0, 0); _schedulingService.Add(100, scheduleCSVHandle, nextScheduleSlot); } else { // Offset is not a function of the currentTime alone. var first = EventsToSend.First(); long baseMsec = _currentTime - _startTime; long afterMsec = first.SendTime - baseMsec; nextScheduleSlot = first.ScheduleSlot; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleNextCallback schedulingCallback in " + afterMsec + " milliseconds"); } _schedulingService.Add(afterMsec, scheduleCSVHandle, nextScheduleSlot); } }
/// <summary> /// Ctor. /// </summary> /// <param name="agentInstanceContext">The agent instance context.</param> /// <param name="viewFactory">for copying this view in a group-by</param> /// <param name="timestampExpr">the property name of the event supplying timestamp values</param> /// <param name="timestampEvaluator">The timestamp evaluator.</param> /// <param name="timeDeltaComputation">The time delta computation.</param> /// <param name="optionalSortedRandomAccess">is the friend class handling the random access, if required byexpressions</param> public TimeOrderView( AgentInstanceViewFactoryChainContext agentInstanceContext, ViewFactory viewFactory, ExprNode timestampExpr, ExprEvaluator timestampEvaluator, ExprTimePeriodEvalDeltaConst timeDeltaComputation, IStreamSortRankRandomAccess optionalSortedRandomAccess) { _agentInstanceContext = agentInstanceContext; _viewFactory = viewFactory; _timestampExpression = timestampExpr; _timestampEvaluator = timestampEvaluator; _timeDeltaComputation = timeDeltaComputation; _optionalSortedRandomAccess = optionalSortedRandomAccess; _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); _sortedEvents = new OrderedDictionary <Object, Object>(); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QViewScheduledEval(this, _viewFactory.ViewName), i => i.AViewScheduledEval(), Expire) }; _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback); agentInstanceContext.AddTerminationCallback(Stop); }
private void ScheduleCallback() { _isCallbackScheduled = true; var current = _context.StatementContext.SchedulingService.Time; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " now=" + current + " currentReferencePoint=" + _currentReferencePoint + " spec=" + _factory.ScheduleSpec); } var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); }) }; var handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); var schedulingService = _context.StatementContext.SchedulingService; var nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance( _factory.ScheduleSpec, schedulingService.Time, _context.StatementContext.MethodResolutionService.EngineImportService.TimeZone); schedulingService.Add(nextScheduledTime, handle, _scheduleSlot); }
/// <summary> /// Constructor. /// </summary> /// <param name="viewUpdatedCollection">is a collection that the view must update when receiving events</param> /// <param name="timeBatchViewFactory">fr copying this view in a group-by</param> /// <param name="agentInstanceContext">is required view services</param> /// <param name="timeDeltaComputation">delta computation</param> public TimeAccumView( TimeAccumViewFactory timeBatchViewFactory, AgentInstanceViewFactoryChainContext agentInstanceContext, ExprTimePeriodEvalDeltaConst timeDeltaComputation, ViewUpdatedCollection viewUpdatedCollection) { _agentInstanceContext = agentInstanceContext; _factory = timeBatchViewFactory; _timeDeltaComputation = timeDeltaComputation; _viewUpdatedCollection = viewUpdatedCollection; _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QViewScheduledEval(this, _factory.ViewName); } SendRemoveStream(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AViewScheduledEval(); } } }; _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback); agentInstanceContext.AddTerminationCallback(this); }
public TimeAccumViewRStream( TimeAccumViewFactory timeBatchViewFactory, AgentInstanceViewFactoryChainContext agentInstanceContext, TimePeriodProvide timePeriodProvide) { _agentInstanceContext = agentInstanceContext.AgentInstanceContext; _factory = timeBatchViewFactory; _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); _timePeriodProvide = timePeriodProvide; ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = () => { agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext.AgentInstanceContext, ScheduleObjectType.view, _factory.ViewName); agentInstanceContext.InstrumentationProvider.QViewScheduledEval(_factory); SendRemoveStream(); agentInstanceContext.InstrumentationProvider.AViewScheduledEval(); }, }; _handle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); }
private void StartContextCallback(long timeOffset) { var scheduleCallback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = extensionServicesContext => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QContextScheduledEval(_agentInstanceContext.StatementContext.ContextDescriptor); } _scheduleHandle = null; // terminates automatically unless scheduled again _callback.RangeNotification(Collections.GetEmptyMap <String, Object>(), this, null, null, _filterAddendum); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AContextScheduledEval(); } } }; var agentHandle = new EPStatementAgentInstanceHandle( _agentInstanceContext.StatementContext.EpStatementHandle, _agentInstanceContext.StatementContext.DefaultAgentInstanceLock, -1, new StatementAgentInstanceFilterVersion(), _agentInstanceContext.StatementContext.FilterFaultHandlerFactory); _scheduleHandle = new EPStatementHandleCallback(agentHandle, scheduleCallback); long timeDelta = _spec.TimePeriod.NonconstEvaluator().DeltaUseEngineTime(null, _agentInstanceContext) - timeOffset; _agentInstanceContext.StatementContext.SchedulingService.Add(timeDelta, _scheduleHandle, _scheduleSlot); }
/// <summary> /// Constructor. /// </summary> /// <param name="timeBatchViewFactory">for copying this view in a group-by</param> /// <param name="agentInstanceContext">The agent instance context.</param> /// <param name="timeDeltaComputation">The time delta computation.</param> public TimeAccumViewRStream( TimeAccumViewFactory timeBatchViewFactory, AgentInstanceViewFactoryChainContext agentInstanceContext, ExprTimePeriodEvalDeltaConst timeDeltaComputation) { _agentInstanceContext = agentInstanceContext; _factory = timeBatchViewFactory; _timeDeltaComputation = timeDeltaComputation; _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => { using (Instrument.With( i => i.QViewScheduledEval(this, _factory.ViewName), i => i.AViewScheduledEval())) { SendRemoveStream(); } } }; _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback); agentInstanceContext.AddTerminationCallback(Stop); }
/// <summary> /// Constructor. /// </summary> /// <param name="agentInstanceContext">The agent instance context.</param> /// <param name="timeWindowViewFactory">for copying the view in a group-by</param> /// <param name="timeDeltaComputation">is the computation of number of milliseconds before events gets pushedout of the timeWindow as oldData in the Update method.</param> /// <param name="viewUpdatedCollection">is a collection the view must Update when receiving events</param> public TimeWindowView( AgentInstanceViewFactoryChainContext agentInstanceContext, TimeWindowViewFactory timeWindowViewFactory, ExprTimePeriodEvalDeltaConst timeDeltaComputation, ViewUpdatedCollection viewUpdatedCollection) { _agentInstanceContext = agentInstanceContext; _timeWindowViewFactory = timeWindowViewFactory; _timeDeltaComputation = timeDeltaComputation; _viewUpdatedCollection = viewUpdatedCollection; _scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); _timeWindow = new TimeWindow(agentInstanceContext.IsRemoveStream); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QViewScheduledEval(this, timeWindowViewFactory.ViewName), i => i.AViewScheduledEval(), Expire) }; _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback); if (agentInstanceContext.StatementContext.ScheduleAdjustmentService != null) { agentInstanceContext.StatementContext.ScheduleAdjustmentService.AddCallback(this); } agentInstanceContext.AddTerminationCallback(Stop); }
private void StartContextCallback() { var scheduleCallback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = (extensionServicesContext) => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QContextScheduledEval(_statementContext.ContextDescriptor); } _scheduleHandle = null; // terminates automatically unless scheduled again _callback.RangeNotification(Collections.EmptyDataMap, this, null, null, _filterAddendum); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AContextScheduledEval(); } } }; var agentHandle = new EPStatementAgentInstanceHandle(_statementContext.EpStatementHandle, _statementContext.DefaultAgentInstanceLock, -1, new StatementAgentInstanceFilterVersion(), _statementContext.FilterFaultHandlerFactory); _scheduleHandle = new EPStatementHandleCallback(agentHandle, scheduleCallback); var schedulingService = _statementContext.SchedulingService; var engineImportService = _statementContext.EngineImportService; var nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance(_spec.Schedule, schedulingService.Time, engineImportService.TimeZone, engineImportService.TimeAbacus); _statementContext.SchedulingService.Add(nextScheduledTime, _scheduleHandle, _scheduleSlot); }
private void ScheduleCallback() { var current = _agentInstanceContext.StatementContext.SchedulingService.Time; TimePeriodDeltaResult deltaWReference = _timePeriodProvide.DeltaAddWReference( current, _currentReferencePoint.Value, null, true, _agentInstanceContext); long afterTime = deltaWReference.Delta; _currentReferencePoint = deltaWReference.LastReference; ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { _agentInstanceContext.AuditProvider.ScheduleFire( _agentInstanceContext, ScheduleObjectType.view, _factory.ViewName); _agentInstanceContext.InstrumentationProvider.QViewScheduledEval(_factory); SendBatch(); _agentInstanceContext.InstrumentationProvider.AViewScheduledEval(); } }; _handle = new EPStatementHandleCallbackSchedule( _agentInstanceContext.EpStatementAgentInstanceHandle, callback); _agentInstanceContext.AuditProvider.ScheduleAdd( afterTime, _agentInstanceContext, _handle, ScheduleObjectType.view, _factory.ViewName); _agentInstanceContext.StatementContext.SchedulingService.Add(afterTime, _handle, _scheduleSlot); }
public TimeAccumView( TimeAccumViewFactory timeBatchViewFactory, AgentInstanceViewFactoryChainContext agentInstanceContext, ViewUpdatedCollection viewUpdatedCollection, TimePeriodProvide timePeriodProvide) { this.agentInstanceContext = agentInstanceContext.AgentInstanceContext; factory = timeBatchViewFactory; this.viewUpdatedCollection = viewUpdatedCollection; scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); this.timePeriodProvide = timePeriodProvide; ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext.AgentInstanceContext, ScheduleObjectType.view, factory.ViewName); agentInstanceContext.InstrumentationProvider.QViewScheduledEval(factory); SendRemoveStream(); agentInstanceContext.InstrumentationProvider.AViewScheduledEval(); } }; handle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); }
private void ScheduleCallback() { _isCallbackScheduled = true; long current = _agentInstanceContext.StatementContext.SchedulingService.Time; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + 0 + " now=" + current); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(true, true); ResetBuiltinProperties(); }) }; _scheduleHandle = new EPStatementHandleCallback( _agentInstanceContext.EpStatementAgentInstanceHandle, callback); _agentInstanceContext.StatementContext.SchedulingService.Add(0, _scheduleHandle, _scheduleSlot); _agentInstanceContext.AddTerminationCallback(Stop); // execute assignments ExecuteThenAssignments(); }
public TimeOrderView( AgentInstanceViewFactoryChainContext agentInstanceContext, TimeOrderViewFactory factory, IStreamSortRankRandomAccess optionalSortedRandomAccess, TimePeriodProvide timePeriodProvide) { this.agentInstanceContext = agentInstanceContext.AgentInstanceContext; this.factory = factory; this.optionalSortedRandomAccess = optionalSortedRandomAccess; scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); this.timePeriodProvide = timePeriodProvide; sortedEvents = new OrderedListDictionary<object, object>(); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext.AgentInstanceContext, ScheduleObjectType.view, factory.ViewName); agentInstanceContext.InstrumentationProvider.QViewScheduledEval(factory); Expire(); agentInstanceContext.InstrumentationProvider.AViewScheduledEval(); } }; handle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); }
protected void ScheduleCallback() { long current = _agentInstanceContext.StatementContext.SchedulingService.Time; ExprTimePeriodEvalDeltaResult deltaWReference = _timeDeltaComputation.DeltaAddWReference( current, _currentReferencePoint.Value); long afterTime = deltaWReference.Delta; _currentReferencePoint = deltaWReference.LastReference; var callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = (extensionServicesContext) => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QViewScheduledEval(this, _timeBatchViewFactory.ViewName); } SendBatch(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AViewScheduledEval(); } } }; _handle = new EPStatementHandleCallback(_agentInstanceContext.EpStatementAgentInstanceHandle, callback); _agentInstanceContext.StatementContext.SchedulingService.Add(afterTime, _handle, _scheduleSlot); }
private void ScheduleCallback() { isCallbackScheduled = true; ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { agentInstanceContext.InstrumentationProvider.QOutputRateConditionScheduledEval(); agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext, ScheduleObjectType.outputratelimiting, NAME_AUDITPROVIDER_SCHEDULE); isCallbackScheduled = false; outputCallback.Invoke(true, true); ResetBuiltinProperties(); agentInstanceContext.InstrumentationProvider.AOutputRateConditionScheduledEval(); } }; scheduleHandle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); agentInstanceContext.AuditProvider.ScheduleAdd( 0, agentInstanceContext, scheduleHandle, ScheduleObjectType.outputratelimiting, NAME_AUDITPROVIDER_SCHEDULE); agentInstanceContext.StatementContext.SchedulingService.Add(0, scheduleHandle, scheduleSlot); // execute assignments ExecuteThenAssignments(); }
protected ExpressionViewBase( ViewUpdatedCollection viewUpdatedCollection, ExprEvaluator expiryExpression, AggregationServiceFactoryDesc aggregationServiceFactoryDesc, ObjectArrayEventBean builtinEventProps, ISet <String> variableNames, AgentInstanceViewFactoryChainContext agentInstanceContext) { ViewUpdatedCollection = viewUpdatedCollection; ExpiryExpression = expiryExpression; BuiltinEventProps = builtinEventProps; EventsPerStream = new EventBean[] { null, builtinEventProps }; VariableNames = variableNames; AgentInstanceContext = agentInstanceContext; if (variableNames != null && !variableNames.IsEmpty()) { foreach (String variable in variableNames) { var variableName = variable; var agentInstanceId = agentInstanceContext.AgentInstanceId; var variableService = agentInstanceContext.StatementContext.VariableService; agentInstanceContext.StatementContext.VariableService.RegisterCallback(variable, agentInstanceId, Update); agentInstanceContext.AddTerminationCallback( new ProxyStopCallback(() => variableService.UnregisterCallback(variableName, agentInstanceId, Update))); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QViewScheduledEval(this, ViewName), i => i.AViewScheduledEval(), ScheduleCallback) }; ScheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); ScheduleHandle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback); agentInstanceContext.AddTerminationCallback(this); } else { ScheduleSlot = -1; ScheduleHandle = null; } if (aggregationServiceFactoryDesc != null) { AggregationService = aggregationServiceFactoryDesc.AggregationServiceFactory.MakeService( agentInstanceContext.AgentInstanceContext, agentInstanceContext.AgentInstanceContext.StatementContext.EngineImportService, false, null); AggregateNodes = aggregationServiceFactoryDesc.Expressions; } else { AggregationService = null; AggregateNodes = Collections.GetEmptyList <AggregationServiceAggExpressionDesc>(); } }
private void ScheduleCallback() { isCallbackScheduled = true; long current = context.StatementContext.SchedulingService.Time; TimePeriodDeltaResult delta = parent.TimePeriodCompute.DeltaAddWReference( current, currentReferencePoint.Value, null, true, context); long deltaTime = delta.Delta; currentReferencePoint = delta.LastReference; currentScheduledTime = deltaTime; if ((ExecutionPathDebugLog.IsDebugEnabled) && (log.IsDebugEnabled)) { log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + deltaTime + " now=" + current + " currentReferencePoint=" + currentReferencePoint); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = () => { context.InstrumentationProvider.QOutputRateConditionScheduledEval(); context.AuditProvider.ScheduleFire( context, ScheduleObjectType.outputratelimiting, NAME_AUDITPROVIDER_SCHEDULE); this.isCallbackScheduled = false; this.outputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); context.InstrumentationProvider.AOutputRateConditionScheduledEval(); }, }; handle = new EPStatementHandleCallbackSchedule(context.EpStatementAgentInstanceHandle, callback); context.AuditProvider.ScheduleAdd( deltaTime, context, handle, ScheduleObjectType.outputratelimiting, NAME_AUDITPROVIDER_SCHEDULE); context.StatementContext.SchedulingService.Add(deltaTime, handle, scheduleSlot); }
protected void ScheduleCallback(long delta) { ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QViewScheduledEval(this, _timeLengthBatchViewFactory.ViewName), i => i.AViewScheduledEval(), () => SendBatch(true)) }; _handle = new EPStatementHandleCallback(_agentInstanceContext.EpStatementAgentInstanceHandle, callback); var currentTime = _agentInstanceContext.StatementContext.SchedulingService.Time; var scheduled = _timeDeltaComputation.DeltaAdd(currentTime) - delta; _agentInstanceContext.StatementContext.SchedulingService.Add(scheduled, _handle, _scheduleSlot); _callbackScheduledTime = _agentInstanceContext.StatementContext.SchedulingService.Time + scheduled; }
private void ScheduleCallback() { long afterMSec = _timeDeltaComputation.DeltaMillisecondsAdd( AgentInstanceContext.StatementContext.SchedulingService.Time); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QViewScheduledEval(this, _timeFirstViewFactory.ViewName), i => i.AViewScheduledEval(), () => { _isClosed = true; InternalHandleClosed(); }) }; _handle = new EPStatementHandleCallback(AgentInstanceContext.EpStatementAgentInstanceHandle, callback); AgentInstanceContext.StatementContext.SchedulingService.Add(afterMSec, _handle, _scheduleSlot); }
protected void ScheduleCallback() { long current = _agentInstanceContext.StatementContext.SchedulingService.Time; ExprTimePeriodEvalDeltaResult deltaWReference = _timeDeltaComputation.DeltaMillisecondsAddWReference( current, _currentReferencePoint.Value); long afterMSec = deltaWReference.Delta; _currentReferencePoint = deltaWReference.LastReference; ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QViewScheduledEval(this, _timeBatchViewFactory.ViewName), i => i.AViewScheduledEval(), SendBatch) }; _handle = new EPStatementHandleCallback(_agentInstanceContext.EpStatementAgentInstanceHandle, callback); _agentInstanceContext.StatementContext.SchedulingService.Add(afterMSec, _handle, _scheduleSlot); }
public void SetScheduleCallback( AgentInstanceContext agentInstanceContext, RowRecogNFAViewScheduleCallback scheduleCallback) { this.agentInstanceContext = agentInstanceContext; scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext, ScheduleObjectType.matchrecognize, NAME_AUDITPROVIDER_SCHEDULE); agentInstanceContext.InstrumentationProvider.QRegExScheduledEval(); scheduleCallback.Triggered(); agentInstanceContext.InstrumentationProvider.ARegExScheduledEval(); } }; handle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); }
protected void ScheduleCallback(long delta) { ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext, ScheduleObjectType.view, factory.ViewName); agentInstanceContext.InstrumentationProvider.QViewScheduledEval(factory); SendBatch(true); agentInstanceContext.InstrumentationProvider.AViewScheduledEval(); } }; handle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); var currentTime = agentInstanceContext.StatementContext.SchedulingService.Time; var scheduled = timePeriodProvide.DeltaAdd(currentTime, null, true, agentInstanceContext) - delta; agentInstanceContext.StatementContext.SchedulingService.Add(scheduled, handle, scheduleSlot); callbackScheduledTime = agentInstanceContext.StatementContext.SchedulingService.Time + scheduled; }
public void SetScheduleCallback(AgentInstanceContext agentInstanceContext, EventRowRegexNFAViewScheduleCallback scheduleCallback) { this.agentInstanceContext = agentInstanceContext; this.scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); ScheduleHandleCallback callback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = (extensionServicesContext) => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QRegExScheduledEval(); } scheduleCallback.Triggered(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().ARegExScheduledEval(); } }, }; this.handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback); }
public bool Activate( EventBean optionalTriggeringEvent, ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider, IDictionary<string, object> optionalTriggeringPattern) { ScheduleHandleCallback scheduleCallback = new ProxyScheduleHandleCallback() { ProcScheduledTrigger = () => { AgentInstanceContext agentInstanceContextX = controller.Realization.AgentInstanceContextCreate; agentInstanceContextX.InstrumentationProvider.QContextScheduledEval( agentInstanceContextX.StatementContext.ContextRuntimeDescriptor); scheduleHandle = null; // terminates automatically unless scheduled again agentInstanceContextX.AuditProvider.ScheduleFire( agentInstanceContextX, ScheduleObjectType.context, NAME_AUDITPROVIDER_SCHEDULE); callback.RangeNotification(conditionPath, this, null, null, null, null); agentInstanceContextX.InstrumentationProvider.AContextScheduledEval(); }, }; AgentInstanceContext agentInstanceContext = controller.Realization.AgentInstanceContextCreate; scheduleHandle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, scheduleCallback); long timeDelta = timePeriod.TimePeriodCompute.DeltaUseRuntimeTime( null, agentInstanceContext, agentInstanceContext.TimeProvider); agentInstanceContext.AuditProvider.ScheduleAdd( timeDelta, agentInstanceContext, scheduleHandle, ScheduleObjectType.context, NAME_AUDITPROVIDER_SCHEDULE); agentInstanceContext.SchedulingService.Add(timeDelta, scheduleHandle, scheduleSlot); return false; }
public bool Activate( EventBean optionalTriggeringEvent, ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider) { ScheduleHandleCallback scheduleCallback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { var inProcAgentInstanceContext = controller.Realization.AgentInstanceContextCreate; inProcAgentInstanceContext.InstrumentationProvider.QContextScheduledEval( inProcAgentInstanceContext.StatementContext.ContextRuntimeDescriptor); scheduleHandle = null; // terminates automatically unless scheduled again inProcAgentInstanceContext.AuditProvider.ScheduleFire( inProcAgentInstanceContext, ScheduleObjectType.context, NAME_AUDITPROVIDER_SCHEDULE); callback.RangeNotification(conditionPath, this, null, null, null, null); inProcAgentInstanceContext.InstrumentationProvider.AContextScheduledEval(); } }; var agentInstanceContext = controller.Realization.AgentInstanceContextCreate; scheduleHandle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, scheduleCallback); long nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance( Schedule, agentInstanceContext.TimeProvider.Time, agentInstanceContext.ImportServiceRuntime.TimeZone, agentInstanceContext.ImportServiceRuntime.TimeAbacus); agentInstanceContext.AuditProvider.ScheduleAdd( nextScheduledTime, agentInstanceContext, scheduleHandle, ScheduleObjectType.context, NAME_AUDITPROVIDER_SCHEDULE); agentInstanceContext.SchedulingService.Add(nextScheduledTime, scheduleHandle, scheduleSlot); return false; }
private void ScheduleCallback() { _isCallbackScheduled = true; var current = _context.StatementContext.SchedulingService.Time; var delta = _parent.TimePeriod.NonconstEvaluator().DeltaAddWReference(current, _currentReferencePoint.Value, null, true, _context); var deltaTime = delta.Delta; _currentReferencePoint = delta.LastReference; _currentScheduledTime = deltaTime; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleCallback Scheduled new callback for " + " afterMsec=" + deltaTime + " now=" + current + " currentReferencePoint=" + _currentReferencePoint); } var callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = (extensionServicesContext) => { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().QOutputRateConditionScheduledEval(); } _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.Get().AOutputRateConditionScheduledEval(); } } }; _handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); _context.StatementContext.SchedulingService.Add(deltaTime, _handle, _scheduleSlot); _context.AddTerminationCallback(this); }
private void ScheduleNextCallback() { var nextScheduleCallback = new ProxyScheduleHandleCallback(delegate { ContinueSendingEvents(); }); var spi = (EPRuntimeSPI)_runtime; var deploymentId = "CSV-adapter-" + UuidGenerator.Generate(); var metricsHandle = spi.ServicesContext.MetricReportingService.GetStatementHandle(-1, deploymentId, "AbstractCoordinatedAdapter"); var lockImpl = _container.RWLockManager().CreateLock("CSV"); var stmtHandle = new EPStatementHandle( "AbstractCoordinatedAdapter", deploymentId, -1, null, 0, false, false, spi.ServicesContext.MultiMatchHandlerFactory.Make(false, false), false, false, metricsHandle, null, null); var agentInstanceHandle = new EPStatementAgentInstanceHandle(stmtHandle, -1, lockImpl); var scheduleCSVHandle = new EPStatementHandleCallbackSchedule(agentInstanceHandle, nextScheduleCallback); long nextScheduleSlot; if (EventsToSend.IsEmpty()) { if ((ExecutionPathDebugLog.IsDebugEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleNextCallback no events to send, scheduling callback in 100 ms"); } nextScheduleSlot = 0L; _schedulingService.Add(100, scheduleCSVHandle, nextScheduleSlot); } else { // Offset is not a function of the currentTime alone. var first = EventsToSend.First(); long baseMsec = _currentTime - _startTime; long afterMsec = first.SendTime - baseMsec; nextScheduleSlot = first.ScheduleSlot; if ((ExecutionPathDebugLog.IsDebugEnabled) && (Log.IsDebugEnabled)) { Log.Debug(".scheduleNextCallback schedulingCallback in " + afterMsec + " milliseconds"); } _schedulingService.Add(afterMsec, scheduleCSVHandle, nextScheduleSlot); } }
private void StartContextCallback() { ScheduleHandleCallback scheduleCallback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QContextScheduledEval(_statementContext.ContextDescriptor), i => i.AContextScheduledEval(), () => { _scheduleHandle = null; // terminates automatically unless scheduled again _callback.RangeNotification( Collections.GetEmptyMap <String, Object>(), this, null, null, _filterAddendum); }) }; var agentHandle = new EPStatementAgentInstanceHandle(_statementContext.EpStatementHandle, _statementContext.DefaultAgentInstanceLock, -1, new StatementAgentInstanceFilterVersion()); _scheduleHandle = new EPStatementHandleCallback(agentHandle, scheduleCallback); var schedulingService = _statementContext.SchedulingService; var nextScheduledTime = ScheduleComputeHelper.ComputeDeltaNextOccurance(_spec.Schedule, schedulingService.Time, _statementContext.MethodResolutionService.EngineImportService.TimeZone); _statementContext.SchedulingService.Add(nextScheduledTime, _scheduleHandle, _scheduleSlot); }
private void ScheduleCallback() { _isCallbackScheduled = true; long current = _context.StatementContext.SchedulingService.Time; ExprTimePeriodEvalDeltaResult delta = _parent.TimePeriod.NonconstEvaluator().DeltaMillisecondsAddWReference( current, _currentReferencePoint.Value, null, true, _context); long afterMSec = delta.Delta; _currentReferencePoint = delta.LastReference; _currentScheduledTime = afterMSec; if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled)) { Log.Debug( ".scheduleCallback Scheduled new callback for " + " afterMsec=" + afterMSec + " now=" + current + " currentReferencePoint=" + _currentReferencePoint); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = extensionServicesContext => Instrument.With( i => i.QOutputRateConditionScheduledEval(), i => i.AOutputRateConditionScheduledEval(), () => { _isCallbackScheduled = false; OutputCallback.Invoke(DO_OUTPUT, FORCE_UPDATE); ScheduleCallback(); }) }; _handle = new EPStatementHandleCallback(_context.EpStatementAgentInstanceHandle, callback); _context.StatementContext.SchedulingService.Add(afterMSec, _handle, _scheduleSlot); _context.AddTerminationCallback(new ProxyStopCallback(Stop)); }