public static StageManager getStageManager() { if(self==null) { self = new StageManager(); } return self; }
private void reportQuery(String stage) { StageManager sm = StageManager.getStageManager(); if(sm.hasRunnerForStage(stage)) { sm.getRunnerForStage(stage).setHasQueried(); } }
public void findAndDestroy(String groupName) { StageRunner sw = removeRunner(groupName); if(sw!=null) { sw.destroy(); } }
public boolean hasRunner(String groupName) { return getRunner(groupName)!=null; }
public boolean hasRunnerForStage(String stage) { return getRunnerForStage(stage)!=null; }
public NodeMaster(CoreConfiguration conf, CachingDocumentNIO<T> documentNIO, Pipeline pipeline, ShutdownHandler shutdownHandler) { this.conf = conf; this.shutdownHandler = shutdownHandler; sm = StageManager.getStageManager(); this.pipeline = pipeline; this.pollingInterval = conf.getPollingInterval(); this.port = conf.getRestPort(); this.namespace = conf.getNamespace(); this.documentNIO = documentNIO; this.dbc = documentNIO.getDatabaseConnector(); } /**
private void startStopped() throws IOException { for(StageRunner runner : sm.getRunners()) { if(!runner.isAlive() && !runner.isStarted()) { runner.prepare(); runner.start(); } } }
private void addMissingGroups(Pipeline newPipeline) { for(StageGroup group : newPipeline.getStageGroups()) { if(!pipeline.hasGroup(group.getName())) { pipeline.addGroup(group); if(attachFiles(group)) { sm.addRunner(new StageRunner(group, new File(namespace), port, conf.isPerformanceLogging(), conf.getLoggingPort(), shutdownHandler)); } else { logger.error("Was unable to start the stage group '"+group.getName()+"' due to missing libraries."); } } } }
private void removeGroup(String group) { pipeline.removeGroup(group); sm.removeRunner(group); }