/// <summary> /// Ctor. /// </summary> /// <param name="agentInstanceHandle">is a statement handle</param> /// <param name="callback">is a schedule callback</param> public EPStatementHandleCallbackSchedule( EPStatementAgentInstanceHandle agentInstanceHandle, ScheduleHandleCallback callback) { this.agentInstanceHandle = agentInstanceHandle; this.scheduleCallback = callback; }
// private ScheduleHandleCallback scheduleCallback; /// <summary> /// Ctor. /// </summary> /// <param name="agentInstanceHandle">is a statement handle</param> /// <param name="callback">is a filter callback</param> public EPStatementHandleCallbackFilter( EPStatementAgentInstanceHandle agentInstanceHandle, FilterHandleCallback callback) { this.agentInstanceHandle = agentInstanceHandle; this.filterCallback = callback; }
public int Compare( AgentInstance ai1, AgentInstance ai2) { EPStatementAgentInstanceHandle o1 = ai1.AgentInstanceContext.EpStatementAgentInstanceHandle; EPStatementAgentInstanceHandle o2 = ai2.AgentInstanceContext.EpStatementAgentInstanceHandle; return(_innerComparator.Compare(o1, o2)); }
public AgentInstanceContext MakeAgentInstanceContextUnpartitioned() { var @lock = StatementAIFactoryProvider.Factory.ObtainAgentInstanceLock(this, -1); var epStatementAgentInstanceHandle = new EPStatementAgentInstanceHandle(EpStatementHandle, -1, @lock); var auditProvider = StatementInformationals.AuditProvider; var instrumentationProvider = StatementInformationals.InstrumentationProvider; return new AgentInstanceContext( this, -1, epStatementAgentInstanceHandle, null, null, auditProvider, instrumentationProvider); }
private static AgentInstanceContext MakeNewAgentInstanceContextCanNull( int agentInstanceId, StatementContext statementContext, bool partitioned) { // re-allocate lock: for unpartitoned cases we use the same lock associated to the statement (no need to produce more locks) var @lock = statementContext.StatementAIFactoryProvider.Factory .ObtainAgentInstanceLock(statementContext, agentInstanceId); var epStatementAgentInstanceHandle = new EPStatementAgentInstanceHandle( statementContext.EpStatementHandle, agentInstanceId, @lock); // filter fault handler for create-context statements var contextName = statementContext.ContextName; MappedEventBean contextProperties = null; AgentInstanceFilterProxy agentInstanceFilterProxy = null; if (contextName != null) { var contextDeploymentId = statementContext.ContextRuntimeDescriptor.ContextDeploymentId; var contextManager = statementContext.ContextManagementService.GetContextManager(contextDeploymentId, contextName); epStatementAgentInstanceHandle.FilterFaultHandler = contextManager; // the context partition may have been deleted var info = contextManager.GetContextAgentInstanceInfo( statementContext, agentInstanceId); if (info == null) { return null; } agentInstanceFilterProxy = info.FilterProxy; contextProperties = info.ContextProperties; } // re-allocate context var auditProvider = statementContext.StatementInformationals.AuditProvider; var instrumentationProvider = statementContext.StatementInformationals.InstrumentationProvider; return new AgentInstanceContext( statementContext, agentInstanceId, epStatementAgentInstanceHandle, agentInstanceFilterProxy, contextProperties, auditProvider, instrumentationProvider); }
public AgentInstanceContext( StatementContext statementContext, EPStatementAgentInstanceHandle epStatementAgentInstanceHandle, AgentInstanceFilterProxy agentInstanceFilterProxy, MappedEventBean contextProperties, AuditProvider auditProvider, InstrumentationCommon instrumentationProvider) { StatementContext = statementContext; FilterVersionAfterAllocation = statementContext.FilterService.FiltersVersion; EpStatementAgentInstanceHandle = epStatementAgentInstanceHandle; AgentInstanceFilterProxy = agentInstanceFilterProxy; _contextProperties = contextProperties; AuditProvider = auditProvider; InstrumentationProvider = instrumentationProvider; }
public static StatementAgentInstanceFactoryResult Start( StatementContextRuntimeServices services, ContextControllerStatementDesc statement, int agentInstanceId, MappedEventBean contextProperties, AgentInstanceFilterProxy agentInstanceFilterProxy, bool isRecoveringResilient) { var statementContext = statement.Lightweight.StatementContext; // create handle that comtains lock for use in scheduling and filter callbacks var @lock = statementContext.StatementAIFactoryProvider.Factory.ObtainAgentInstanceLock( statementContext, agentInstanceId); var agentInstanceHandle = new EPStatementAgentInstanceHandle(statementContext.EpStatementHandle, agentInstanceId, @lock); var auditProvider = statementContext.StatementInformationals.AuditProvider; var instrumentationProvider = statementContext.StatementInformationals.InstrumentationProvider; var agentInstanceContext = new AgentInstanceContext( statementContext, agentInstanceHandle, agentInstanceFilterProxy, contextProperties, auditProvider, instrumentationProvider); if (agentInstanceId != -1) { agentInstanceContext.AuditProvider.ContextPartition(true, agentInstanceContext); } var statementAgentInstanceLock = agentInstanceContext.EpStatementAgentInstanceHandle.StatementAgentInstanceLock; agentInstanceContext.InstrumentationProvider.QContextPartitionAllocate(agentInstanceContext); using (statementAgentInstanceLock.AcquireWriteLock()) { try { // start var startResult = statement.Lightweight.StatementProvider.StatementAIFactoryProvider.Factory.NewContext( agentInstanceContext, isRecoveringResilient); // hook up with listeners+subscribers startResult.FinalView.Child = statement.ContextMergeView; // hook output to merge view // assign agents for expression-node based strategies var aiResourceRegistry = statementContext.StatementAIResourceRegistry; AIRegistryUtil.AssignFutures( aiResourceRegistry, agentInstanceId, startResult.OptionalAggegationService, startResult.PriorStrategies, startResult.PreviousGetterStrategies, startResult.SubselectStrategies, startResult.TableAccessStrategies, startResult.RowRecogPreviousStrategy); // execute preloads, if any if (startResult.PreloadList != null) { foreach (var preload in startResult.PreloadList) { preload.ExecutePreload(); } } // handle any pattern-match-event that was produced during startup, relevant for "timer:interval(0)" in conjunction with contexts startResult.PostContextMergeRunnable?.Invoke(); var holder = services.StatementResourceHolderBuilder.Build(agentInstanceContext, startResult); statementContext.StatementCPCacheService.StatementResourceService.SetPartitioned( agentInstanceId, holder); // instantiated return startResult; } finally { if (agentInstanceContext.StatementContext.EpStatementHandle.HasTableAccess) { agentInstanceContext.TableExprEvaluatorContext.ReleaseAcquiredLocks(); } agentInstanceContext.InstrumentationProvider.AContextPartitionAllocate(); } } }