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());
}
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;
}
Aggregations