Search in sources :

Example 1 with DirectoryCleaner

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();
    }
}
Also used : StormMetricsRegistry(org.apache.storm.metric.StormMetricsRegistry) DirectoryCleaner(org.apache.storm.daemon.logviewer.utils.DirectoryCleaner) WorkerLogs(org.apache.storm.daemon.logviewer.utils.WorkerLogs) File(java.io.File) LogCleaner(org.apache.storm.daemon.logviewer.utils.LogCleaner)

Aggregations

File (java.io.File)1 DirectoryCleaner (org.apache.storm.daemon.logviewer.utils.DirectoryCleaner)1 LogCleaner (org.apache.storm.daemon.logviewer.utils.LogCleaner)1 WorkerLogs (org.apache.storm.daemon.logviewer.utils.WorkerLogs)1 StormMetricsRegistry (org.apache.storm.metric.StormMetricsRegistry)1