use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class TransactionManagers method createRawRemoteServices.
private static LockAndTimestampServices createRawRemoteServices(AtlasDbConfig config, String userAgent) {
LockService lockService = new ServiceCreator<>(LockService.class, userAgent).apply(config.lock().get());
TimestampService timeService = new ServiceCreator<>(TimestampService.class, userAgent).apply(config.timestamp().get());
return ImmutableLockAndTimestampServices.builder().lock(lockService).timestamp(timeService).timelock(new LegacyTimelockService(timeService, lockService, LOCK_CLIENT)).build();
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class TransactionManagers method createRawEmbeddedServices.
private static LockAndTimestampServices createRawEmbeddedServices(Consumer<Object> env, com.google.common.base.Supplier<LockService> lock, com.google.common.base.Supplier<TimestampService> time) {
LockService lockService = ServiceCreator.createInstrumentedService(lock.get(), LockService.class);
TimestampService timeService = ServiceCreator.createInstrumentedService(time.get(), TimestampService.class);
env.accept(lockService);
env.accept(timeService);
return ImmutableLockAndTimestampServices.builder().lock(lockService).timestamp(timeService).timelock(new LegacyTimelockService(timeService, lockService, LOCK_CLIENT)).build();
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class ServiceDiscoveringAtlasSupplierTest method delegateToFactoriesAnnotatedWithAutoServiceForCreatingTimestampServices.
@Test
public void delegateToFactoriesAnnotatedWithAutoServiceForCreatingTimestampServices() {
ServiceDiscoveringAtlasSupplier atlasSupplier = new ServiceDiscoveringAtlasSupplier(kvsConfig, leaderConfig);
TimestampService timestampService = mock(TimestampService.class);
AutoServiceAnnotatedAtlasDbFactory.nextTimestampServiceToReturn(timestampService);
assertThat(atlasSupplier.getTimestampService(), is(timestampService));
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class TimestampRemotingTest method testNotLeader.
@Test
public void testNotLeader() {
ObjectMapper mapper = new ObjectMapper();
String uri = notLeader.baseUri().toString();
TimestampService ts = Feign.builder().decoder(new JacksonDecoder(mapper)).encoder(new JacksonEncoder(mapper)).contract(new JAXRSContract()).retryer(new Retryer.Default(1, 1, 40)).target(TimestampService.class, notLeader.baseUri().toString());
ts.getFreshTimestamp();
}
use of com.palantir.timestamp.TimestampService in project atlasdb by palantir.
the class TimestampRemotingTest method testSerializing.
@Test
public void testSerializing() {
ObjectMapper mapper = new ObjectMapper();
String uri = dropwizard.baseUri().toString();
TimestampService ts = Feign.builder().decoder(new JacksonDecoder(mapper)).encoder(new JacksonEncoder(mapper)).contract(new JAXRSContract()).target(TimestampService.class, uri);
long freshTimestamp = ts.getFreshTimestamp();
TimestampRange freshTimestamps = ts.getFreshTimestamps(100);
}
Aggregations