Shutdown the OAP server when catch any exception. (#2352)

This commit is contained in:
彭勇升 pengys 2019-03-12 22:52:38 +08:00 committed by 吴晟 Wu Sheng
parent 0951b9434b
commit 70e6c203ab
1 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ package org.apache.skywalking.oap.server.starter;
import org.apache.skywalking.oap.server.core.RunningMode;
import org.apache.skywalking.oap.server.library.module.*;
import org.apache.skywalking.oap.server.starter.config.*;
import org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoader;
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
import org.apache.skywalking.oap.server.telemetry.api.*;
import org.slf4j.*;
@ -45,14 +45,14 @@ public class OAPServerStartUp {
manager.find(TelemetryModule.NAME).provider().getService(MetricCreator.class).createGauge("uptime",
"oap server start up time", MetricTag.EMPTY_KEY, MetricTag.EMPTY_VALUE)
// Set uptime to second
.setValue(System.currentTimeMillis() / 1000);
.setValue(System.currentTimeMillis() / 1000d);
if (RunningMode.isInitMode()) {
logger.info("OAP starts up in init mode successfully, exit now...");
System.exit(0);
}
} catch (ConfigFileNotFoundException | ModuleNotFoundException | ProviderNotFoundException | ServiceNotProvidedException | ModuleConfigException | ModuleStartException e) {
logger.error(e.getMessage(), e);
} catch (Throwable t) {
logger.error(t.getMessage(), t);
System.exit(1);
}
}