use of org.apache.storm.daemon.logviewer.utils.DirectoryCleaner in project storm by apache.
the class LogviewerServer method main.
/**
* Main method to start the server.
*/
public static void main(String[] args) throws Exception {
Utils.setupDefaultUncaughtExceptionHandler();
Map<String, Object> conf = ConfigUtils.readStormConfig();
StormMetricsRegistry metricsRegistry = new StormMetricsRegistry();
String logRoot = ConfigUtils.workerArtifactsRoot(conf);
File logRootDir = new File(logRoot);
logRootDir.mkdirs();
WorkerLogs workerLogs = new WorkerLogs(conf, logRootDir.toPath(), metricsRegistry);
DirectoryCleaner directoryCleaner = new DirectoryCleaner(metricsRegistry);
try (LogviewerServer server = new LogviewerServer(conf, metricsRegistry);
LogCleaner logCleaner = new LogCleaner(conf, workerLogs, directoryCleaner, logRootDir.toPath(), metricsRegistry)) {
metricsRegistry.startMetricsReporters(conf);
Utils.addShutdownHookWithForceKillIn1Sec(() -> {
server.meterShutdownCalls.mark();
metricsRegistry.stopMetricsReporters();
server.close();
});
logCleaner.start();
server.start();
server.awaitTermination();
}
}
Aggregations