Search in sources :

Example 11 with TimestampService

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();
}
Also used : LegacyTimelockService(com.palantir.lock.impl.LegacyTimelockService) NoOpPersistentLockService(com.palantir.atlasdb.persistentlock.NoOpPersistentLockService) KvsBackedPersistentLockService(com.palantir.atlasdb.persistentlock.KvsBackedPersistentLockService) LockService(com.palantir.lock.LockService) LockRefreshingLockService(com.palantir.lock.client.LockRefreshingLockService) PersistentLockService(com.palantir.atlasdb.persistentlock.PersistentLockService) TimestampService(com.palantir.timestamp.TimestampService)

Example 12 with TimestampService

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();
}
Also used : LegacyTimelockService(com.palantir.lock.impl.LegacyTimelockService) NoOpPersistentLockService(com.palantir.atlasdb.persistentlock.NoOpPersistentLockService) KvsBackedPersistentLockService(com.palantir.atlasdb.persistentlock.KvsBackedPersistentLockService) LockService(com.palantir.lock.LockService) LockRefreshingLockService(com.palantir.lock.client.LockRefreshingLockService) PersistentLockService(com.palantir.atlasdb.persistentlock.PersistentLockService) TimestampService(com.palantir.timestamp.TimestampService)

Example 13 with TimestampService

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));
}
Also used : TimestampService(com.palantir.timestamp.TimestampService) Test(org.junit.Test)

Example 14 with 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();
}
Also used : JacksonEncoder(feign.jackson.JacksonEncoder) JAXRSContract(feign.jaxrs.JAXRSContract) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) TimestampService(com.palantir.timestamp.TimestampService) JacksonDecoder(feign.jackson.JacksonDecoder) Test(org.junit.Test)

Example 15 with TimestampService

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);
}
Also used : JacksonEncoder(feign.jackson.JacksonEncoder) JAXRSContract(feign.jaxrs.JAXRSContract) TimestampRange(com.palantir.timestamp.TimestampRange) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) TimestampService(com.palantir.timestamp.TimestampService) JacksonDecoder(feign.jackson.JacksonDecoder) Test(org.junit.Test)

Aggregations

TimestampService (com.palantir.timestamp.TimestampService)26 Test (org.junit.Test)12 InMemoryTimestampService (com.palantir.timestamp.InMemoryTimestampService)7 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)6 LockService (com.palantir.lock.LockService)6 SingleBackendCliTestRunner (com.palantir.atlasdb.cli.runner.SingleBackendCliTestRunner)5 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)5 DaggerTestAtlasDbServices (com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices)5 TestAtlasDbServices (com.palantir.atlasdb.services.test.TestAtlasDbServices)5 LockRefreshingLockService (com.palantir.lock.client.LockRefreshingLockService)4 Before (org.junit.Before)4 KvsBackedPersistentLockService (com.palantir.atlasdb.persistentlock.KvsBackedPersistentLockService)3 NoOpPersistentLockService (com.palantir.atlasdb.persistentlock.NoOpPersistentLockService)3 PersistentLockService (com.palantir.atlasdb.persistentlock.PersistentLockService)3 SweepStrategyManager (com.palantir.atlasdb.transaction.impl.SweepStrategyManager)3 TransactionService (com.palantir.atlasdb.transaction.service.TransactionService)3 LockClient (com.palantir.lock.LockClient)3 LegacyTimelockService (com.palantir.lock.impl.LegacyTimelockService)3 TimestampManagementService (com.palantir.timestamp.TimestampManagementService)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2