Search in sources :

Example 1 with AsyncTimelockServiceImpl

use of com.palantir.atlasdb.timelock.AsyncTimelockServiceImpl in project atlasdb by palantir.

the class AsyncTimeLockServicesCreator method createRawAsyncTimelockService.

private static AsyncTimelockService createRawAsyncTimelockService(String client, Supplier<ManagedTimestampService> timestampServiceSupplier) {
    ScheduledExecutorService reaperExecutor = new InstrumentedScheduledExecutorService(PTExecutors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("async-lock-reaper-" + client + "-%d").setDaemon(true).build()), AtlasDbMetrics.getMetricRegistry(), "async-lock-reaper");
    ScheduledExecutorService timeoutExecutor = new InstrumentedScheduledExecutorService(PTExecutors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("async-lock-timeouts-" + client + "-%d").setDaemon(true).build()), AtlasDbMetrics.getMetricRegistry(), "async-lock-timeouts");
    return new AsyncTimelockServiceImpl(AsyncLockService.createDefault(reaperExecutor, timeoutExecutor), timestampServiceSupplier.get());
}
Also used : InstrumentedScheduledExecutorService(com.codahale.metrics.InstrumentedScheduledExecutorService) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) InstrumentedScheduledExecutorService(com.codahale.metrics.InstrumentedScheduledExecutorService) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) AsyncTimelockServiceImpl(com.palantir.atlasdb.timelock.AsyncTimelockServiceImpl)

Aggregations

InstrumentedScheduledExecutorService (com.codahale.metrics.InstrumentedScheduledExecutorService)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 AsyncTimelockServiceImpl (com.palantir.atlasdb.timelock.AsyncTimelockServiceImpl)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1