Search in sources :

Example 1 with ReportWorkerHeartbeats

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());
}
Also used : ReportWorkerHeartbeats(org.apache.storm.daemon.supervisor.timer.ReportWorkerHeartbeats) SynchronizeAssignments(org.apache.storm.daemon.supervisor.timer.SynchronizeAssignments) SupervisorHeartbeat(org.apache.storm.daemon.supervisor.timer.SupervisorHeartbeat) EventManagerImp(org.apache.storm.event.EventManagerImp) SupervisorHealthCheck(org.apache.storm.daemon.supervisor.timer.SupervisorHealthCheck) File(java.io.File)

Aggregations

File (java.io.File)1 ReportWorkerHeartbeats (org.apache.storm.daemon.supervisor.timer.ReportWorkerHeartbeats)1 SupervisorHealthCheck (org.apache.storm.daemon.supervisor.timer.SupervisorHealthCheck)1 SupervisorHeartbeat (org.apache.storm.daemon.supervisor.timer.SupervisorHeartbeat)1 SynchronizeAssignments (org.apache.storm.daemon.supervisor.timer.SynchronizeAssignments)1 EventManagerImp (org.apache.storm.event.EventManagerImp)1