use of com.palantir.timestamp.ManagedTimestampService in project atlasdb by palantir.
the class AsyncTimelockServiceImplTest method delegatesInitializationCheck.
@Test
public void delegatesInitializationCheck() {
ManagedTimestampService mockMts = mock(ManagedTimestampService.class);
AsyncTimelockServiceImpl service = new AsyncTimelockServiceImpl(mock(AsyncLockService.class), mockMts, mock(LockLog.class));
when(mockMts.isInitialized()).thenReturn(false).thenReturn(true);
assertThat(service.isInitialized()).isFalse();
assertThat(service.isInitialized()).isTrue();
}
use of com.palantir.timestamp.ManagedTimestampService in project atlasdb by palantir.
the class TimeLockAgent method createInvalidatingTimeLockServices.
/**
* Creates timestamp and lock services for the given client. It is expected that for each client there should
* only be (up to) one active timestamp service, and one active lock service at any time.
* @param client Client namespace to create the services for
* @return Invalidating timestamp and lock services
*/
public TimeLockServices createInvalidatingTimeLockServices(String client) {
LeaderConfig leaderConfig = createLeaderConfig();
Client typedClient = Client.of(client);
Supplier<ManagedTimestampService> rawTimestampServiceSupplier = timestampStorage.timestampCreator().createTimestampService(typedClient, leaderConfig);
Supplier<LockService> rawLockServiceSupplier = lockCreator::createThreadPoolingLockService;
return timelockCreator.createTimeLockServices(typedClient, rawTimestampServiceSupplier, rawLockServiceSupplier);
}
use of com.palantir.timestamp.ManagedTimestampService in project atlasdb by palantir.
the class CassandraTestTools method getMutationProviderWithStartingTimestamp.
public static CassandraMutationTimestampProvider getMutationProviderWithStartingTimestamp(long timestamp, InMemoryTimeLockRule services) {
ManagedTimestampService timestampService = services.getManagedTimestampService();
timestampService.fastForwardTimestamp(timestamp);
return CassandraMutationTimestampProviders.singleLongSupplierBacked(timestampService::getFreshTimestamp);
}
Aggregations