use of com.palantir.timelock.paxos.TimeLockAgent in project atlasdb by palantir.
the class TimelockBenchmarkServerLauncher method run.
@Override
public void run(TimelockBenchmarkServerConfig configuration, Environment environment) throws Exception {
FeignOkHttpClients.globalClientSettings = client -> client.hostnameVerifier((ig, nored) -> true);
TimeLockAgent agent = TimeLockAgent.create(configuration.install(), // this won't actually live reload
configuration::runtime, ImmutableTimeLockDeprecatedConfiguration.builder().build(), environment.jersey()::register);
}
use of com.palantir.timelock.paxos.TimeLockAgent 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