public static bool Evaluate( EventBean[] eventsPerStream, AgentInstanceContext agentInstanceContext, ExpressionViewFactoryBase factory, AggregationService aggregationService) { // Evaluation with aggregation requires a lock on the factory as the aggregation-field is assigned per-factory if (aggregationService != null) { lock (factory) { factory.AggregationResultFutureAssignable.Assign(aggregationService); var resultX = factory.ExpiryEval.Evaluate(eventsPerStream, true, agentInstanceContext); if (resultX == null) { return false; } return true.Equals(resultX); } } var result = factory.ExpiryEval.Evaluate(eventsPerStream, true, agentInstanceContext); if (result == null) { return false; } return true.Equals(result); }
public ExpressionViewBase( ExpressionViewFactoryBase factory, ViewUpdatedCollection viewUpdatedCollection, ObjectArrayEventBean builtinEventProps, AgentInstanceViewFactoryChainContext agentInstanceContext) { this.factory = factory; this.viewUpdatedCollection = viewUpdatedCollection; this.builtinEventProps = builtinEventProps; eventsPerStream = new EventBean[] {null, builtinEventProps}; this.agentInstanceContext = agentInstanceContext.AgentInstanceContext; if (factory.Variables != null && factory.Variables.Length > 0) { foreach (var variable in factory.Variables) { var variableDepId = variable.DeploymentId; var variableName = variable.MetaData.VariableName; int agentInstanceId = agentInstanceContext.AgentInstanceId; agentInstanceContext.StatementContext.VariableManagementService.RegisterCallback( variable.DeploymentId, variableName, agentInstanceId, this); agentInstanceContext.AgentInstanceContext.AddTerminationCallback( new ProxyAgentInstanceMgmtCallback { ProcStop = services => { services.AgentInstanceContext.VariableManagementService .UnregisterCallback(variableDepId, variableName, agentInstanceId, this); } }); } ScheduleHandleCallback callback = new ProxyScheduleHandleCallback { ProcScheduledTrigger = () => { agentInstanceContext.AuditProvider.ScheduleFire( agentInstanceContext.AgentInstanceContext, ScheduleObjectType.view, factory.ViewName); agentInstanceContext.InstrumentationProvider.QViewScheduledEval(factory); ScheduleCallback(); agentInstanceContext.InstrumentationProvider.AViewScheduledEval(); } }; scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot(); scheduleHandle = new EPStatementHandleCallbackSchedule( agentInstanceContext.EpStatementAgentInstanceHandle, callback); } else { scheduleSlot = -1; scheduleHandle = null; } if (factory.AggregationServiceFactory != null) { aggregationService = factory.AggregationServiceFactory.MakeService( agentInstanceContext.AgentInstanceContext, agentInstanceContext.ImportService, false, null, null); } else { aggregationService = null; } }