use of org.apache.storm.daemon.supervisor.timer.UpdateBlobs 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());
}
Aggregations