public String launchGlobal( String title, String type, Map<String, Object> configuration, User creator, boolean isExclusive) throws ExclusiveInputException { Node master = serverNodes.master(); InputLaunchResponse ilr = master.launchInput(title, type, true, configuration, creator, isExclusive); if (ilr == null) { throw new RuntimeException("Unable to launch global input!"); } for (Node serverNode : serverNodes.all()) { if (!serverNode.isMaster()) serverNode.launchExistingInput(ilr.persistId); } try { for (Radio radio : nodeService.radios().values()) { radio.launchExistingInput(ilr.persistId); } } catch (APIException e) { log.error("Unable to fetch list of radios: " + e); } catch (IOException e) { log.error("Unable to fetch list of radios: " + e); } return ilr.persistId; }
public Map<ClusterEntity, Boolean> terminateGlobal(String inputId) { Map<ClusterEntity, Boolean> results = Maps.newHashMap(); for (Node serverNode : serverNodes.all()) if (!serverNode.isMaster()) results.put(serverNode, serverNode.terminateInput(inputId)); try { for (Radio radio : nodeService.radios().values()) results.put(radio, radio.terminateInput(inputId)); } catch (APIException e) { log.error("Unable to fetch list of radios: " + e); } catch (IOException e) { log.error("Unable to fetch list of radios: " + e); } Node master = serverNodes.master(); results.put(master, master.terminateInput(inputId)); return results; }