@Override public ListenableFuture<?> apply(ProgramController controller) { return controller.command(ProgramOptionConstants.INSTANCES, newInstanceCount); } })).get();
@Override public ListenableFuture<?> apply(ProgramController controller) { return controller.command(ProgramOptionConstants.INSTANCES, newInstanceCount); } })).get();
@Override public void handleCommand(Command command) throws Exception { // need to make sure controller exists before handling the command if (ProgramCommands.SUSPEND.equals(command)) { controllerFuture.get().suspend().get(); return; } if (ProgramCommands.RESUME.equals(command)) { controllerFuture.get().resume().get(); return; } if (ProgramOptionConstants.INSTANCES.equals(command.getCommand())) { int instances = Integer.parseInt(command.getOptions().get("count")); controllerFuture.get().command(ProgramOptionConstants.INSTANCES, instances).get(); return; } LOG.warn("Ignore unsupported command: " + command); }
@Override public void handleCommand(Command command) throws Exception { // need to make sure controller exists before handling the command if (ProgramCommands.SUSPEND.equals(command)) { controllerFuture.get().suspend().get(); return; } if (ProgramCommands.RESUME.equals(command)) { controllerFuture.get().resume().get(); return; } if (ProgramOptionConstants.INSTANCES.equals(command.getCommand())) { int instances = Integer.parseInt(command.getOptions().get("count")); controllerFuture.get().command(ProgramOptionConstants.INSTANCES, instances).get(); return; } LOG.warn("Ignore unsupported command: " + command); }
private void setFlowletInstances(ProgramId programId, String flowletId, int instances) throws ExecutionException, InterruptedException, BadRequestException { int oldInstances = store.getFlowletInstances(programId, flowletId); if (oldInstances != instances) { FlowSpecification flowSpec = store.setFlowletInstances(programId, flowletId, instances); ProgramRuntimeService.RuntimeInfo runtimeInfo = findRuntimeInfo(programId); if (runtimeInfo != null) { runtimeInfo.getController() .command(ProgramOptionConstants.INSTANCES, ImmutableMap.of("flowlet", flowletId, "newInstances", String.valueOf(instances), "oldFlowSpec", GSON.toJson(flowSpec, FlowSpecification.class))).get(); } } }
private void setServiceInstances(ProgramId programId, int instances) throws ExecutionException, InterruptedException, BadRequestException { int oldInstances = store.getServiceInstances(programId); if (oldInstances != instances) { store.setServiceInstances(programId, instances); ProgramRuntimeService.RuntimeInfo runtimeInfo = findRuntimeInfo(programId); if (runtimeInfo != null) { runtimeInfo.getController().command(ProgramOptionConstants.INSTANCES, ImmutableMap.of("runnable", programId.getProgram(), "newInstances", String.valueOf(instances), "oldInstances", String.valueOf(oldInstances))).get(); } } }
private void setWorkerInstances(ProgramId programId, int instances) throws ExecutionException, InterruptedException, BadRequestException { int oldInstances = store.getWorkerInstances(programId); if (oldInstances != instances) { store.setWorkerInstances(programId, instances); ProgramRuntimeService.RuntimeInfo runtimeInfo = findRuntimeInfo(programId); if (runtimeInfo != null) { runtimeInfo.getController().command(ProgramOptionConstants.INSTANCES, ImmutableMap.of("runnable", programId.getProgram(), "newInstances", String.valueOf(instances), "oldInstances", String.valueOf(oldInstances))).get(); } } }
private void setWorkerInstances(ProgramId programId, int instances) throws ExecutionException, InterruptedException, BadRequestException { int oldInstances = store.getWorkerInstances(programId); if (oldInstances != instances) { store.setWorkerInstances(programId, instances); ProgramRuntimeService.RuntimeInfo runtimeInfo = findRuntimeInfo(programId); if (runtimeInfo != null) { runtimeInfo.getController().command(ProgramOptionConstants.INSTANCES, ImmutableMap.of("runnable", programId.getProgram(), "newInstances", String.valueOf(instances), "oldInstances", String.valueOf(oldInstances))).get(); } } }
private void setServiceInstances(ProgramId programId, int instances) throws ExecutionException, InterruptedException, BadRequestException { int oldInstances = store.getServiceInstances(programId); if (oldInstances != instances) { store.setServiceInstances(programId, instances); ProgramRuntimeService.RuntimeInfo runtimeInfo = findRuntimeInfo(programId); if (runtimeInfo != null) { runtimeInfo.getController().command(ProgramOptionConstants.INSTANCES, ImmutableMap.of("runnable", programId.getProgram(), "newInstances", String.valueOf(instances), "oldInstances", String.valueOf(oldInstances))).get(); } } }
entry.getValue().command(ProgramOptionConstants.INSTANCES, newCount);
entry.getValue().command(ProgramOptionConstants.INSTANCES, newCount);