use of org.apache.storm.daemon.supervisor.timer.ReportWorkerHeartbeats in project storm by apache.
the class Supervisor method launch.
/**
* Launch the supervisor.
*/
public void launch() throws Exception {
LOG.info("Starting Supervisor with conf {}", ConfigUtils.maskPasswords(conf));
String path = ServerConfigUtils.supervisorTmpDir(conf);
FileUtils.cleanDirectory(new File(path));
SupervisorHeartbeat hb = new SupervisorHeartbeat(conf, this);
hb.run();
// should synchronize supervisor so it doesn't launch anything after being down (optimization)
Integer heartbeatFrequency = ObjectReader.getInt(conf.get(DaemonConfig.SUPERVISOR_HEARTBEAT_FREQUENCY_SECS));
heartbeatTimer.scheduleRecurring(0, heartbeatFrequency, hb);
this.eventManager = new EventManagerImp(false);
this.readState = new ReadClusterState(this);
asyncLocalizer.start();
if ((Boolean) conf.get(DaemonConfig.SUPERVISOR_ENABLE)) {
// This isn't strictly necessary, but it doesn't hurt and ensures that the machine stays up
// to date even if callbacks don't all work exactly right
eventTimer.scheduleRecurring(0, 10, new EventManagerPushCallback(new SynchronizeAssignments(this, null, readState), eventManager));
// supervisor health check
eventTimer.scheduleRecurring(30, 30, new SupervisorHealthCheck(this));
}
ReportWorkerHeartbeats reportWorkerHeartbeats = new ReportWorkerHeartbeats(conf, this);
Integer workerHeartbeatFrequency = ObjectReader.getInt(conf.get(Config.WORKER_HEARTBEAT_FREQUENCY_SECS));
workerHeartbeatTimer.scheduleRecurring(0, workerHeartbeatFrequency, reportWorkerHeartbeats);
LOG.info("Starting supervisor with id {} at host {}.", getId(), getHostName());
}
Aggregations