Search in sources :

Example 1 with TargetedSweeper

use of com.palantir.atlasdb.sweep.queue.TargetedSweeper in project atlasdb by palantir.

the class AtlasDbEteServer method run.

@Override
public void run(AtlasDbEteConfiguration config, final Environment environment) throws Exception {
    TaggedMetricRegistry taggedMetrics = SharedTaggedMetricRegistries.getSingleton();
    TransactionManager txManager = tryToCreateTransactionManager(config, environment, taggedMetrics);
    Supplier<SweepTaskRunner> sweepTaskRunner = Suppliers.memoize(() -> getSweepTaskRunner(txManager));
    TargetedSweeper sweeper = TargetedSweeper.createUninitializedForTest(() -> 1);
    Supplier<TargetedSweeper> sweeperSupplier = Suppliers.memoize(() -> initializeAndGet(sweeper, txManager));
    ensureTransactionSchemaVersionInstalled(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), txManager);
    if (shouldSetUpBackupAndRestoreResource(config)) {
        createAndRegisterBackupAndRestoreResource(config, environment, txManager, taggedMetrics);
    }
    environment.jersey().register(new SimpleTodoResource(new TodoClient(txManager, sweepTaskRunner, sweeperSupplier)));
    environment.jersey().register(SimpleCoordinationResource.create(txManager));
    environment.jersey().register(ConjureJerseyFeature.INSTANCE);
    environment.jersey().register(new NotInitializedExceptionMapper());
    environment.jersey().register(new SimpleEteTimestampResource(txManager));
    environment.jersey().register(new SimpleLockResource(txManager));
    environment.jersey().register(new EmptyOptionalTo204ExceptionMapper());
}
Also used : SimpleEteTimestampResource(com.palantir.atlasdb.timestamp.SimpleEteTimestampResource) NotInitializedExceptionMapper(com.palantir.atlasdb.http.NotInitializedExceptionMapper) TransactionManager(com.palantir.atlasdb.transaction.api.TransactionManager) TodoClient(com.palantir.atlasdb.todo.TodoClient) TaggedMetricRegistry(com.palantir.tritium.metrics.registry.TaggedMetricRegistry) SimpleLockResource(com.palantir.atlasdb.lock.SimpleLockResource) SweepTaskRunner(com.palantir.atlasdb.sweep.SweepTaskRunner) SimpleTodoResource(com.palantir.atlasdb.todo.SimpleTodoResource) TargetedSweeper(com.palantir.atlasdb.sweep.queue.TargetedSweeper)

Example 2 with TargetedSweeper

use of com.palantir.atlasdb.sweep.queue.TargetedSweeper in project atlasdb by palantir.

the class KeyValueServiceMigratorsTest method createMock.

private static AtlasDbServices createMock(KeyValueService kvs, InMemoryTimeLockRule timeLock) {
    ManagedTimestampService timestampService = timeLock.getManagedTimestampService();
    TransactionTables.createTables(kvs);
    TransactionService transactionService = spy(TransactionServices.createRaw(kvs, timestampService, false));
    AtlasDbServices mockServices = mock(AtlasDbServices.class);
    when(mockServices.getManagedTimestampService()).thenReturn(timestampService);
    when(mockServices.getTransactionService()).thenReturn(transactionService);
    when(mockServices.getKeyValueService()).thenReturn(kvs);
    TargetedSweeper sweeper = TargetedSweeper.createUninitializedForTest(() -> 1);
    SerializableTransactionManager txManager = SerializableTransactionManager.createForTest(MetricsManagers.createForTests(), kvs, timeLock.getLegacyTimelockService(), timestampService, timeLock.getLockService(), timeLock.getLockWatchManager(), transactionService, () -> AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING, ConflictDetectionManagers.createWithoutWarmingCache(kvs), SweepStrategyManagers.createDefault(kvs), new NoOpCleaner(), 16, 4, sweeper);
    sweeper.initialize(txManager);
    when(mockServices.getTransactionManager()).thenReturn(txManager);
    return mockServices;
}
Also used : TransactionService(com.palantir.atlasdb.transaction.service.TransactionService) NoOpCleaner(com.palantir.atlasdb.cleaner.NoOpCleaner) ManagedTimestampService(com.palantir.timestamp.ManagedTimestampService) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) AtlasDbServices(com.palantir.atlasdb.services.AtlasDbServices) TargetedSweeper(com.palantir.atlasdb.sweep.queue.TargetedSweeper)

Aggregations

TargetedSweeper (com.palantir.atlasdb.sweep.queue.TargetedSweeper)2 NoOpCleaner (com.palantir.atlasdb.cleaner.NoOpCleaner)1 NotInitializedExceptionMapper (com.palantir.atlasdb.http.NotInitializedExceptionMapper)1 SimpleLockResource (com.palantir.atlasdb.lock.SimpleLockResource)1 AtlasDbServices (com.palantir.atlasdb.services.AtlasDbServices)1 SweepTaskRunner (com.palantir.atlasdb.sweep.SweepTaskRunner)1 SimpleEteTimestampResource (com.palantir.atlasdb.timestamp.SimpleEteTimestampResource)1 SimpleTodoResource (com.palantir.atlasdb.todo.SimpleTodoResource)1 TodoClient (com.palantir.atlasdb.todo.TodoClient)1 TransactionManager (com.palantir.atlasdb.transaction.api.TransactionManager)1 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)1 TransactionService (com.palantir.atlasdb.transaction.service.TransactionService)1 ManagedTimestampService (com.palantir.timestamp.ManagedTimestampService)1 TaggedMetricRegistry (com.palantir.tritium.metrics.registry.TaggedMetricRegistry)1