void addStage(ExecutionStage stage) { Validate.isTrue(stage.getPlatformExecution() == this); this.stages.add(stage); }
public Map toJsonMap() { HashMap<String, Object> jsonMap = new HashMap<>(); ArrayList<Map> operators = new ArrayList<>(); jsonMap.put("platform", this.getPlatformExecution().getPlatform().getName()); jsonMap.put("operators", operators); Set<ExecutionTask> seenTasks = new HashSet<>(); for (ExecutionTask startTask : this.startTasks) { this.toJsonMapAux(startTask, seenTasks, operators); } return jsonMap; }
/** * Scrap {@link Channel}s and {@link ExecutionTask}s that are not within the given {@link ExecutionStage}s. * * @return {@link Channel}s from that consumer {@link ExecutionTask}s have been removed */ public Set<Channel> retain(Set<ExecutionStage> retainableStages) { Set<Channel> openChannels = new HashSet<>(); for (ExecutionStage stage : retainableStages) { for (Channel channel : stage.getOutboundChannels()) { if (channel.retain(retainableStages)) { openChannels.add(channel); } } stage.retainSuccessors(retainableStages); stage.getPlatformExecution().retain(retainableStages); } return openChannels; }
private Executor getOrCreateExecutorFor(ExecutionStage stage) { return this.executors.computeIfAbsent( stage.getPlatformExecution().getPlatform(), platform -> { // It is important to register the Executor. This way, we ensure that it will also not be disposed // among disconnected PlatformExecutions. The downside is, that we only remove it, once the // execution is done. final Executor executor = platform.getExecutorFactory().create(this.job); this.registerGlobal(executor); return executor; } ); }
this.createStageFor(task, producer.getStage().getPlatformExecution());