Search in sources :

Example 1 with SimpleLockResource

use of com.palantir.atlasdb.lock.SimpleLockResource 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)

Aggregations

NotInitializedExceptionMapper (com.palantir.atlasdb.http.NotInitializedExceptionMapper)1 SimpleLockResource (com.palantir.atlasdb.lock.SimpleLockResource)1 SweepTaskRunner (com.palantir.atlasdb.sweep.SweepTaskRunner)1 TargetedSweeper (com.palantir.atlasdb.sweep.queue.TargetedSweeper)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 TaggedMetricRegistry (com.palantir.tritium.metrics.registry.TaggedMetricRegistry)1