public override void RangeNotification( IntSeqKey conditionPath, ContextControllerConditionNonHA originCondition, EventBean optionalTriggeringEvent, IDictionary<string, object> optionalTriggeringPattern, EventBean optionalTriggeringEventPattern, IDictionary<string, object> optionalPatternForInclusiveEval) { bool endConditionNotification = originCondition.Descriptor != factory.InitTermSpec.StartCondition; if (endConditionNotification) { RangeNotificationEnd( conditionPath, originCondition, optionalTriggeringEvent, optionalTriggeringPattern, optionalTriggeringEventPattern); } else { RangeNotificationStart( conditionPath, originCondition, optionalTriggeringEvent, optionalTriggeringPattern, optionalTriggeringEventPattern); } }
public override void Activate( IntSeqKey path, object[] parentPartitionKeys, EventBean optionalTriggeringEvent, IDictionary<string, object> optionalTriggeringPattern) { initTermSvc.MgmtCreate(path, parentPartitionKeys); ContextControllerConditionNonHA startCondition = ContextControllerConditionFactory.GetEndpoint( path, parentPartitionKeys, factory.initTermSpec.StartCondition, this, this, true); bool isTriggeringEventMatchesFilter = startCondition.Activate(optionalTriggeringEvent, null); initTermSvc.MgmtUpdSetStartCondition(path, startCondition); if (isTriggeringEventMatchesFilter || startCondition.IsImmediate) { InstantiateAndActivateEndCondition( path, optionalTriggeringEvent, optionalTriggeringPattern, optionalTriggeringPattern, startCondition); } }
public abstract void RangeNotification( IntSeqKey conditionPath, ContextControllerConditionNonHA originEndpoint, EventBean optionalTriggeringEvent, IDictionary<string, object> optionalTriggeringPattern, EventBean optionalTriggeringEventPattern, IDictionary<string, object> optionalPatternForInclusiveEval);
public ContextControllerKeyedSvcEntry( int subpathOrCPId, ContextControllerConditionNonHA terminationCondition) { SubpathOrCPId = subpathOrCPId; TerminationCondition = terminationCondition; }
public void KeyAdd( IntSeqKey controllerPath, object key, int subpathIdOrCPId, ContextControllerConditionNonHA terminationCondition) { _keys.Put(key, new ContextControllerKeyedSvcEntry(subpathIdOrCPId, terminationCondition)); }
public void MgmtUpdSetStartCondition( IntSeqKey controllerPath, ContextControllerConditionNonHA startCondition) { var existing = mgmt.Get(controllerPath); if (existing != null) { existing.startCondition = startCondition; } }
internal NestedEntry( int currentSubpath, ContextControllerConditionNonHA startCondition, object[] parentPartitionKeys) { this.currentSubpath = currentSubpath; this.startCondition = startCondition; this.parentPartitionKeys = parentPartitionKeys; }
public ContextControllerInitTermSvcEntry( int subpathIdOrCPId, ContextControllerConditionNonHA terminationCondition, ContextControllerInitTermPartitionKey partitionKey) { SubpathIdOrCPId = subpathIdOrCPId; TerminationCondition = terminationCondition; PartitionKey = partitionKey; }
public void EndCreate( IntSeqKey endConditionPath, int subpathIdOrCPId, ContextControllerConditionNonHA endCondition, ContextControllerInitTermPartitionKey partitionKey) { endConditions.Put( ((IntSeqKeyOne) endConditionPath).One, new ContextControllerInitTermSvcEntry(subpathIdOrCPId, endCondition, partitionKey)); }
public ContextControllerConditionNonHA MgmtUpdClearStartCondition(IntSeqKey controllerPath) { var existing = mgmt.Get(controllerPath); ContextControllerConditionNonHA tmp = null; if (existing != null) { tmp = existing.startCondition; existing.startCondition = null; } return tmp; }
internal IList<AgentInstance> InstantiateAndActivateEndCondition( IntSeqKey controllerPath, EventBean optionalTriggeringEvent, IDictionary<string, object> optionalTriggeringPattern, IDictionary<string, object> optionalPatternForInclusiveEval, ContextControllerConditionNonHA startCondition) { var subpathId = initTermSvc.MgmtUpdIncSubpath(controllerPath); var endConditionPath = controllerPath.AddToEnd(subpathId); var partitionKeys = initTermSvc.MgmtGetParentPartitionKeys(controllerPath); var endCondition = ContextControllerConditionFactory.GetEndpoint( endConditionPath, partitionKeys, factory.initTermSpec.EndCondition, this, this, false); endCondition.Activate(optionalTriggeringEvent, this); var partitionKey = ContextControllerInitTermUtil.BuildPartitionKey( optionalTriggeringEvent, optionalTriggeringPattern, endCondition, this); var result = realization.ContextPartitionInstantiate( controllerPath, subpathId, this, optionalTriggeringEvent, optionalPatternForInclusiveEval, partitionKeys, partitionKey); var subpathIdOrCPId = result.SubpathOrCPId; initTermSvc.EndCreate(endConditionPath, subpathIdOrCPId, endCondition, partitionKey); return result.AgentInstances; }
public void Destroy() { currentSubpath = 0; startCondition = null; endConditions = null; }
public void MgmtUpdSetStartCondition( IntSeqKey controllerPath, ContextControllerConditionNonHA startCondition) { this.startCondition = startCondition; }
public ContextControllerConditionNonHA MgmtUpdClearStartCondition(IntSeqKey controllerPath) { var tmp = startCondition; startCondition = null; return tmp; }
public void MatchFound( ContextControllerDetailKeyedItem item, EventBean theEvent, IntSeqKey controllerPath, string optionalInitCondAsName) { if (controllerPath.Length != Factory.FactoryEnv.NestingLevel - 1) { throw new IllegalStateException("Unrecognized controller path"); } var getterKey = item.Getter.Get(theEvent); var exists = keyedSvc.KeyHasSeen(controllerPath, getterKey); if (exists || theEvent == LastTerminatingEvent) { // if all-matches is more than one, the termination has also fired return; } LastTerminatingEvent = null; var partitionKey = getterKey; if (KeyedFactory.KeyedSpec.HasAsName) { partitionKey = new ContextControllerKeyedPartitionKeyWInit( getterKey, optionalInitCondAsName, optionalInitCondAsName == null ? null : theEvent); } var parentPartitionKeys = keyedSvc.MgmtGetPartitionKeys(controllerPath); // get next subpath id var subpathId = keyedSvc.MgmtGetIncSubpath(controllerPath); // instantiate var result = realization.ContextPartitionInstantiate( controllerPath, subpathId, this, theEvent, null, parentPartitionKeys, partitionKey); var subpathIdOrCPId = result.SubpathOrCPId; // handle termination filter ContextControllerConditionNonHA terminationCondition = null; if (KeyedFactory.KeyedSpec.OptionalTermination != null) { var conditionPath = controllerPath.AddToEnd(subpathIdOrCPId); terminationCondition = ActivateTermination( theEvent, parentPartitionKeys, partitionKey, conditionPath, optionalInitCondAsName); foreach (var agentInstance in result.AgentInstances) { agentInstance.AgentInstanceContext.EpStatementAgentInstanceHandle.FilterFaultHandler = ContextControllerWTerminationFilterFaultHandler.INSTANCE; } } keyedSvc.KeyAdd(controllerPath, getterKey, subpathIdOrCPId, terminationCondition); // update the filter version for this handle var filterVersionAfterStart = realization.AgentInstanceContextCreate.FilterService.FiltersVersion; realization.AgentInstanceContextCreate.EpStatementAgentInstanceHandle.StatementFilterVersion .StmtFilterVersion = filterVersionAfterStart; }
private void RangeNotificationEnd( IntSeqKey conditionPath, ContextControllerConditionNonHA endCondition, EventBean optionalTriggeringEvent, IDictionary<string, object> optionalTriggeringPattern, EventBean optionalTriggeringEventPattern) { if (endCondition.IsRunning) { endCondition.Deactivate(); } var instance = initTermSvc.EndDelete(conditionPath); if (instance == null) { return; } // start "@now" we maintain the locks var startNow = factory.InitTermSpec.StartCondition is ContextConditionDescriptorImmediate; IList<AgentInstance> agentInstancesLocksHeld = null; if (startNow) { realization.AgentInstanceContextCreate.FilterService.AcquireWriteLock(); agentInstancesLocksHeld = new List<AgentInstance>(2); } realization.ContextPartitionTerminate( conditionPath.RemoveFromEnd(), instance.SubpathIdOrCPId, this, optionalTriggeringPattern, startNow, agentInstancesLocksHeld); try { var controllerPath = conditionPath.RemoveFromEnd(); var partitionKeys = initTermSvc.MgmtGetParentPartitionKeys(controllerPath); var startDesc = factory.initTermSpec.StartCondition; var startCondition = ContextControllerConditionFactory.GetEndpoint( controllerPath, partitionKeys, startDesc, this, this, true); if (!startCondition.IsImmediate) { startCondition.Activate(optionalTriggeringEvent, null, optionalTriggeringPattern); initTermSvc.MgmtUpdSetStartCondition(controllerPath, startCondition); } else { // we do not forward triggering events of termination InstantiateAndActivateEndCondition(controllerPath, null, null, null, startCondition); } } finally { if (agentInstancesLocksHeld != null) { foreach (var agentInstance in agentInstancesLocksHeld) { agentInstance.AgentInstanceContext.EpStatementAgentInstanceHandle.StatementFilterVersion .StmtFilterVersion = long.MaxValue; if (agentInstance.AgentInstanceContext.StatementContext.EpStatementHandle.HasTableAccess) { agentInstance.AgentInstanceContext.TableExprEvaluatorContext.ReleaseAcquiredLocks(); } agentInstance.AgentInstanceContext.AgentInstanceLock.ReleaseWriteLock(); } } if (startNow) { realization.AgentInstanceContextCreate.FilterService.ReleaseWriteLock(); } } }