Search in sources :

Example 6 with ManagedTimestampService

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();
}
Also used : LockLog(com.palantir.atlasdb.timelock.lock.LockLog) AsyncLockService(com.palantir.atlasdb.timelock.lock.AsyncLockService) ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService) Test(org.junit.Test)

Example 7 with ManagedTimestampService

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);
}
Also used : LeaderConfig(com.palantir.atlasdb.config.LeaderConfig) ImmutableLeaderConfig(com.palantir.atlasdb.config.ImmutableLeaderConfig) LockService(com.palantir.lock.LockService) ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService) Client(com.palantir.paxos.Client)

Example 8 with ManagedTimestampService

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);
}
Also used : ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService)

Aggregations

ManagedTimestampService (com.palantir.timestamp.ManagedTimestampService)8 LockService (com.palantir.lock.LockService)3 LockRefreshingLockService (com.palantir.lock.client.LockRefreshingLockService)2 LegacyTimelockService (com.palantir.lock.impl.LegacyTimelockService)2 TimestampManagementService (com.palantir.timestamp.TimestampManagementService)2 TimestampService (com.palantir.timestamp.TimestampService)2 Test (org.junit.Test)2 NoOpCleaner (com.palantir.atlasdb.cleaner.NoOpCleaner)1 ImmutableLeaderConfig (com.palantir.atlasdb.config.ImmutableLeaderConfig)1 ImmutableServerListConfig (com.palantir.atlasdb.config.ImmutableServerListConfig)1 LeaderConfig (com.palantir.atlasdb.config.LeaderConfig)1 LocalPaxosServices (com.palantir.atlasdb.factory.Leaders.LocalPaxosServices)1 ServiceDiscoveringAtlasSupplier (com.palantir.atlasdb.factory.ServiceDiscoveringAtlasSupplier)1 AtlasDbServices (com.palantir.atlasdb.services.AtlasDbServices)1 TargetedSweeper (com.palantir.atlasdb.sweep.queue.TargetedSweeper)1 AsyncLockService (com.palantir.atlasdb.timelock.lock.AsyncLockService)1 LockLog (com.palantir.atlasdb.timelock.lock.LockLog)1 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)1 TransactionService (com.palantir.atlasdb.transaction.service.TransactionService)1 UnknownRemoteException (com.palantir.conjure.java.api.errors.UnknownRemoteException)1