use of com.palantir.atlasdb.timelock.config.CombinedTimeLockServerConfiguration in project atlasdb by palantir.
the class TimeLockServerLauncher method run.
@Override
public void run(TimeLockServerConfiguration configuration, Environment environment) {
environment.getObjectMapper().registerModule(new Jdk8Module());
environment.jersey().register(HttpRemotingJerseyFeature.INSTANCE);
CombinedTimeLockServerConfiguration combined = TimeLockConfigMigrator.convert(configuration, environment);
Consumer<Object> registrar = component -> environment.jersey().register(component);
TimeLockAgent.create(combined.install(), // this won't actually live reload
combined::runtime, combined.deprecated(), registrar);
}
use of com.palantir.atlasdb.timelock.config.CombinedTimeLockServerConfiguration in project atlasdb by palantir.
the class TimeLockServerLauncher method run.
@Override
public void run(CombinedTimeLockServerConfiguration configuration, Environment environment) throws JsonProcessingException {
environment.getObjectMapper().registerModule(new Jdk8Module()).registerModule(new JavaTimeModule());
environment.jersey().register(ConjureJerseyFeature.INSTANCE);
environment.jersey().register(new EmptyOptionalTo204ExceptionMapper());
MetricsManager metricsManager = MetricsManagers.of(environment.metrics(), taggedMetricRegistry);
Consumer<Object> registrar = component -> environment.jersey().register(component);
log.info("Paxos configuration\n{}", UnsafeArg.of("paxosConfig", environment.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(configuration.install().paxos())));
TimeLockRuntimeConfiguration runtime = configuration.runtime();
TimeLockAgent timeLockAgent = TimeLockAgent.create(metricsManager, configuration.install(), // this won't actually live reload
Refreshable.only(runtime), runtime.clusterSnapshot(), USER_AGENT, CombinedTimeLockServerConfiguration.threadPoolSize(), CombinedTimeLockServerConfiguration.blockingTimeoutMs(), registrar, Optional.empty(), OrderableSlsVersion.valueOf("0.0.0"), environment.getObjectMapper(), () -> System.exit(0));
environment.lifecycle().manage(new Managed() {
@Override
public void start() {
}
@Override
public void stop() {
}
});
environment.lifecycle().addLifeCycleListener(new LifeCycle.Listener() {
@Override
public void lifeCycleStarting(LifeCycle event) {
}
@Override
public void lifeCycleStarted(LifeCycle event) {
}
@Override
public void lifeCycleFailure(LifeCycle event, Throwable cause) {
shutdownFuture.setException(cause);
}
@Override
public void lifeCycleStopping(LifeCycle event) {
}
@Override
public void lifeCycleStopped(LifeCycle event) {
timeLockAgent.shutdown();
shutdownFuture.set(null);
}
});
}
Aggregations