Search in sources :

Example 1 with ExecutorCloser

use of org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser in project jackrabbit-oak by apache.

the class AtomicCounterEditorProvider method deactivate.

@Deactivate
public void deactivate() {
    ScheduledExecutorService ses = getScheduler();
    if (ses == null) {
        LOG.debug("No ScheduledExecutorService found");
    } else {
        LOG.debug("Shutting down ScheduledExecutorService");
        new ExecutorCloser(ses).close();
    }
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser) Deactivate(org.apache.felix.scr.annotations.Deactivate)

Example 2 with ExecutorCloser

use of org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser in project jackrabbit-oak by apache.

the class FileCacheStats method close.

@Override
public void close() {
    LOG.info("Cache stats on close [{}]", cacheStats.cacheInfoAsString());
    new ExecutorCloser(executor).close();
}
Also used : ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser)

Example 3 with ExecutorCloser

use of org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser in project jackrabbit-oak by apache.

the class BlobIdTracker method close.

/**
     * Closes the tracker and the underlying store.
     *
     * @throws IOException
     */
@Override
public void close() throws IOException {
    store.close();
    new ExecutorCloser(scheduler).close();
}
Also used : ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser)

Example 4 with ExecutorCloser

use of org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser in project jackrabbit-oak by apache.

the class StagingUploader method close.

@Override
public void close() {
    LOG.info("Uploads in progress on close [{}]", map.size());
    LOG.info("Uploads completed but not cleared from cache [{}]", attic.size());
    LOG.info("Staging cache stats on close [{}]", cacheStats.cacheInfoAsString());
    new ExecutorCloser(executor).close();
    new ExecutorCloser(scheduledExecutor).close();
}
Also used : ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser)

Example 5 with ExecutorCloser

use of org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser in project jackrabbit-oak by apache.

the class StatisticsProviderFactory method deactivate.

@Deactivate
private void deactivate() throws IOException {
    for (ServiceRegistration reg : regs) {
        reg.unregister();
    }
    regs.clear();
    if (statisticsProvider instanceof Closeable) {
        ((Closeable) statisticsProvider).close();
    }
    new ExecutorCloser(executor).close();
}
Also used : Closeable(java.io.Closeable) ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser) ServiceRegistration(org.osgi.framework.ServiceRegistration) Deactivate(org.apache.felix.scr.annotations.Deactivate)

Aggregations

ExecutorCloser (org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser)36 Test (org.junit.Test)15 File (java.io.File)14 CountDownLatch (java.util.concurrent.CountDownLatch)13 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)11 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)9 ExecutorService (java.util.concurrent.ExecutorService)6 DefaultStatisticsProvider (org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)5 After (org.junit.After)5 Callable (java.util.concurrent.Callable)4 Future (java.util.concurrent.Future)4 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)4 InputStream (java.io.InputStream)3 StatisticsProvider (org.apache.jackrabbit.oak.stats.StatisticsProvider)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 Closeable (java.io.Closeable)2 IOException (java.io.IOException)2 List (java.util.List)2