Program program = Programs.create(location.append(flowName));
Multimap<String, QueueName> consumerQueues = FlowUtils.configureQueue(program, program.getSpecification(),
queueAdmin);
DistributedFlowletInstanceUpdater instanceUpdater = new DistributedFlowletInstanceUpdater(
program, controller, queueAdmin, consumerQueues);
FlowTwillProgramController flowController = new FlowTwillProgramController(program.getName(), controller,
instanceUpdater);
Map<String, String> instanceOptions = Maps.newHashMap();
instanceOptions.put("flowlet", flowletName);
instanceOptions.put("newInstances", String.valueOf(instanceCount));
instanceOptions.put("oldInstances", String.valueOf(oldInstances));
flowController.command(ProgramOptionConstants.FLOWLET_INSTANCES, instanceOptions).get();
}
} catch (Exception e) {
LOG.warn(e.getMessage(), e);
}
}