private void TraverseContextPartitions( DeploymentInternal deployment, Consumer <StatementResourceHolder> consumer) { foreach (EPStatement statement in deployment.Statements) { EPStatementSPI spi = (EPStatementSPI)statement; if (spi.StatementContext.ContextName == null) { StatementResourceHolder holder = spi.StatementContext.StatementCPCacheService.MakeOrGetEntryCanNull(-1, spi.StatementContext); consumer.Invoke(holder); } else { ContextRuntimeDescriptor contextDesc = spi.StatementContext.ContextRuntimeDescriptor; ContextManager contextManager = _servicesContext.ContextManagementService.GetContextManager( contextDesc.ContextDeploymentId, contextDesc.ContextName); ICollection <int> agentInstanceIds = contextManager.Realization.GetAgentInstanceIds(ContextPartitionSelectorAll.INSTANCE); foreach (int agentInstanceId in agentInstanceIds) { StatementResourceHolder holder = spi.StatementContext.StatementCPCacheService.MakeOrGetEntryCanNull(agentInstanceId, spi.StatementContext); consumer.Invoke(holder); } } } }
public void Stage(ICollection <string> deploymentIdsProvided) { lock (this) { CheckDestroyed(); ISet <string> deploymentIds = CheckArgument(deploymentIdsProvided); if (deploymentIds.IsEmpty()) { return; } CheckDeploymentIdsExist(deploymentIds, _servicesContext.DeploymentLifecycleService); ValidateDependencyPreconditions(deploymentIds, _servicesContext, _servicesContext.DeploymentLifecycleService); ISet <int> statementIds = new HashSet <int>(); foreach (string deploymentId in deploymentIds) { DeploymentInternal deployment = _servicesContext.DeploymentLifecycleService.GetDeploymentById(deploymentId); TraverseContextPartitions(deployment, ProcessStage); TraverseStatements(deployment, statementContext => UpdateStatement(statementContext, _stageSpecificServices), statementIds); MovePath(deployment, _servicesContext, _stageSpecificServices); _servicesContext.DeploymentLifecycleService.RemoveDeployment(deploymentId); _stageSpecificServices.DeploymentLifecycleService.AddDeployment(deploymentId, deployment); _servicesContext.StageRecoveryService.DeploymentSetStage(deploymentId, _stageUri); } _servicesContext.SchedulingServiceSPI.Transfer(statementIds, _stageSpecificServices.SchedulingServiceSPI); } }
private void TraverseStatements( DeploymentInternal deployment, Consumer <StatementContext> consumer, ISet <int> statementIds) { foreach (EPStatement statement in deployment.Statements) { EPStatementSPI spi = (EPStatementSPI)statement; consumer.Invoke(spi.StatementContext); statementIds.Add(spi.StatementId); } }
private void CheckDeploymentIdsExist( ISet <string> deploymentIds, DeploymentLifecycleService deploymentLifecycleService) { foreach (string deploymentId in deploymentIds) { DeploymentInternal deployment = deploymentLifecycleService.GetDeploymentById(deploymentId); if (deployment == null) { throw new EPStageException("Deployment '" + deploymentId + "' was not found"); } } }
public static void MovePath( DeploymentInternal deployment, EPServicesPath from, EPServicesPath to) { var moduleName = deployment.ModuleProvider.ModuleName; HandleProvided(deployment.DeploymentId, deployment.PathNamedWindows, from.NamedWindowPathRegistry, moduleName, to.NamedWindowPathRegistry); HandleProvided(deployment.DeploymentId, deployment.PathTables, from.TablePathRegistry, moduleName, to.TablePathRegistry); HandleProvided(deployment.DeploymentId, deployment.PathContexts, from.ContextPathRegistry, moduleName, to.ContextPathRegistry); HandleProvided(deployment.DeploymentId, deployment.PathVariables, from.VariablePathRegistry, moduleName, to.VariablePathRegistry); HandleProvided(deployment.DeploymentId, deployment.PathEventTypes, from.EventTypePathRegistry, moduleName, to.EventTypePathRegistry); HandleProvided(deployment.DeploymentId, deployment.PathExprDecls, from.ExprDeclaredPathRegistry, moduleName, to.ExprDeclaredPathRegistry); HandleProvided(deployment.DeploymentId, deployment.PathScripts, from.ScriptPathRegistry, moduleName, to.ScriptPathRegistry); }
public void AddDeployment( string deploymentId, DeploymentInternal deployment) { var existing = DeploymentMap.Get(deploymentId); if (existing != null) { throw new IllegalStateException("Deployment already exists by name '" + deploymentId + "'"); } var crc = CRC32Util.ComputeCRC32(deploymentId); existing = deploymentsByCRC.Get(crc); if (existing != null) { throw new IllegalStateException("Deployment already exists by same-value crc"); } DeploymentMap.Put(deploymentId, deployment); deploymentsByCRC.Put(crc, deployment); }
public void RecoverDeployment( string stageUri, DeploymentInternal deployment) { string deploymentId = deployment.DeploymentId; _services.DeploymentLifecycleService.RemoveDeployment(deploymentId); _stages.Get(stageUri).StageSpecificServices.DeploymentLifecycleService.AddDeployment(deploymentId, deployment); StageSpecificServices stageSpecificServices = _stages.Get(stageUri).EventServiceSPI.SpecificServices; foreach (EPStatement statement in deployment.Statements) { EPStatementSPI spi = (EPStatementSPI)statement; UpdateStatement(spi.StatementContext, stageSpecificServices); if (Equals(spi.GetProperty(StatementProperty.STATEMENTTYPE), StatementType.UPDATE)) { _services.InternalEventRouter.MovePreprocessing(spi.StatementContext, stageSpecificServices.InternalEventRouter); } } }