Search in sources :

Example 1 with SupervisorHealthCheck

use of org.apache.storm.daemon.supervisor.timer.SupervisorHealthCheck in project storm by apache.

the class Supervisor method launch.

/**
     * Launch the supervisor
     */
public void launch() throws Exception {
    LOG.info("Starting Supervisor with conf {}", conf);
    String path = ConfigUtils.supervisorTmpDir(conf);
    FileUtils.cleanDirectory(new File(path));
    Localizer localizer = getLocalizer();
    SupervisorHeartbeat hb = new SupervisorHeartbeat(conf, this);
    hb.run();
    // should synchronize supervisor so it doesn't launch anything after being down (optimization)
    Integer heartbeatFrequency = Utils.getInt(conf.get(Config.SUPERVISOR_HEARTBEAT_FREQUENCY_SECS));
    heartbeatTimer.scheduleRecurring(0, heartbeatFrequency, hb);
    this.eventManager = new EventManagerImp(false);
    this.readState = new ReadClusterState(this);
    Set<String> downloadedTopoIds = SupervisorUtils.readDownloadedTopologyIds(conf);
    for (String topoId : downloadedTopoIds) {
        SupervisorUtils.addBlobReferences(localizer, topoId, conf);
    }
    // do this after adding the references so we don't try to clean things being used
    localizer.startCleaner();
    UpdateBlobs updateBlobsThread = new UpdateBlobs(this);
    if ((Boolean) conf.get(Config.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(readState, eventManager));
        // Blob update thread. Starts with 30 seconds delay, every 30 seconds
        blobUpdateTimer.scheduleRecurring(30, 30, new EventManagerPushCallback(updateBlobsThread, eventManager));
        // supervisor health check
        eventTimer.scheduleRecurring(300, 300, new SupervisorHealthCheck(this));
    }
    LOG.info("Starting supervisor with id {} at host {}.", getId(), getHostName());
}
Also used : UpdateBlobs(org.apache.storm.daemon.supervisor.timer.UpdateBlobs) SupervisorHeartbeat(org.apache.storm.daemon.supervisor.timer.SupervisorHeartbeat) EventManagerImp(org.apache.storm.event.EventManagerImp) ILocalizer(org.apache.storm.localizer.ILocalizer) AsyncLocalizer(org.apache.storm.localizer.AsyncLocalizer) Localizer(org.apache.storm.localizer.Localizer) SupervisorHealthCheck(org.apache.storm.daemon.supervisor.timer.SupervisorHealthCheck) File(java.io.File)

Aggregations

File (java.io.File)1 SupervisorHealthCheck (org.apache.storm.daemon.supervisor.timer.SupervisorHealthCheck)1 SupervisorHeartbeat (org.apache.storm.daemon.supervisor.timer.SupervisorHeartbeat)1 UpdateBlobs (org.apache.storm.daemon.supervisor.timer.UpdateBlobs)1 EventManagerImp (org.apache.storm.event.EventManagerImp)1 AsyncLocalizer (org.apache.storm.localizer.AsyncLocalizer)1 ILocalizer (org.apache.storm.localizer.ILocalizer)1 Localizer (org.apache.storm.localizer.Localizer)1