Search in sources :

Example 6 with DefaultStatisticsProvider

use of org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider in project jackrabbit-oak by apache.

the class TemporaryFileStore method before.

@Override
protected void before() throws Throwable {
    executor = Executors.newSingleThreadScheduledExecutor();
    FileStoreBuilder builder = fileStoreBuilder(folder.newFolder()).withMaxFileSize(1).withMemoryMapping(false).withNodeDeduplicationCacheSize(1).withSegmentCacheSize(0).withStringCacheSize(0).withTemplateCacheSize(0).withStatisticsProvider(new DefaultStatisticsProvider(executor));
    if (standby) {
        builder.withSnfeListener(SegmentNotFoundExceptionListener.IGNORE_SNFE);
    }
    if (blobStore != null) {
        builder.withBlobStore(blobStore.blobStore());
    }
    store = builder.build();
}
Also used : FileStoreBuilder(org.apache.jackrabbit.oak.segment.file.FileStoreBuilder) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider)

Example 7 with DefaultStatisticsProvider

use of org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider in project jackrabbit-oak by apache.

the class SegmentDataStoreBlobGCIT method getNodeStore.

private SegmentNodeStore getNodeStore(BlobStore blobStore) throws Exception {
    if (nodeStore == null) {
        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        FileStoreBuilder builder = fileStoreBuilder(getWorkDir()).withNodeDeduplicationCacheSize(16384).withBlobStore(blobStore).withMaxFileSize(256).withMemoryMapping(false).withStatisticsProvider(new DefaultStatisticsProvider(executor)).withGCOptions(gcOptions);
        store = builder.build();
        nodeStore = SegmentNodeStoreBuilders.builder(store).build();
    }
    return nodeStore;
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) FileStoreBuilder(org.apache.jackrabbit.oak.segment.file.FileStoreBuilder) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider)

Example 8 with DefaultStatisticsProvider

use of org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider in project jackrabbit-oak by apache.

the class UploadStagingCacheTest method init.

private void init(int i, TestStagingUploader testUploader, File homeDir) {
    // uploader
    uploader = testUploader;
    // create executor
    taskLatch = new CountDownLatch(1);
    callbackLatch = new CountDownLatch(1);
    afterExecuteLatch = new CountDownLatch(i);
    executor = new TestExecutor(1, taskLatch, callbackLatch, afterExecuteLatch);
    // stats
    ScheduledExecutorService statsExecutor = Executors.newSingleThreadScheduledExecutor();
    closer.register(new ExecutorCloser(statsExecutor, 500, TimeUnit.MILLISECONDS));
    statsProvider = new DefaultStatisticsProvider(statsExecutor);
    removeExecutor = Executors.newSingleThreadScheduledExecutor();
    closer.register(new ExecutorCloser(removeExecutor, 500, TimeUnit.MILLISECONDS));
    //cache instance
    stagingCache = UploadStagingCache.build(root, homeDir, 1, /*threads*/
    8 * 1024, /* bytes */
    uploader, null, /*cache*/
    statsProvider, executor, null, 3000, 6000);
    closer.register(stagingCache);
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider) CountDownLatch(java.util.concurrent.CountDownLatch) ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser)

Example 9 with DefaultStatisticsProvider

use of org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider in project jackrabbit-oak by apache.

the class ConsolidatedDataStoreStatsTest method init.

private void init(int i) throws Exception {
    testFile = folder.newFile();
    copyInputStreamToFile(randomStream(0, 16384), testFile);
    String testNodeId = getIdForInputStream(new FileInputStream(testFile));
    mockBlob = mock(Blob.class);
    when(mockBlob.getContentIdentity()).thenReturn(testNodeId);
    nodeStore = initNodeStore(Optional.of(mockBlob), Optional.<Blob>absent(), Optional.<String>absent(), Optional.<Integer>absent(), Optional.<List<Blob>>absent());
    // create executor
    taskLatch = new CountDownLatch(1);
    callbackLatch = new CountDownLatch(1);
    afterExecuteLatch = new CountDownLatch(i);
    executor = new TestExecutor(1, taskLatch, callbackLatch, afterExecuteLatch);
    // stats
    ScheduledExecutorService statsExecutor = Executors.newSingleThreadScheduledExecutor();
    closer.register(new ExecutorCloser(statsExecutor, 500, TimeUnit.MILLISECONDS));
    statsProvider = new DefaultStatisticsProvider(statsExecutor);
    scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
    closer.register(new ExecutorCloser(scheduledExecutor, 500, TimeUnit.MILLISECONDS));
    final File datastoreRoot = folder.newFolder();
    dataStore = new AbstractSharedCachingDataStore() {

        @Override
        protected AbstractSharedBackend createBackend() {
            return new TestMemoryBackend(datastoreRoot);
        }

        @Override
        public int getMinRecordLength() {
            return 0;
        }
    };
    dataStore.setStatisticsProvider(statsProvider);
    dataStore.listeningExecutor = executor;
    dataStore.schedulerExecutor = scheduledExecutor;
    dataStore.init(root.getAbsolutePath());
    stats = new ConsolidatedDataStoreCacheStats();
    stats.nodeStore = nodeStore;
    stats.cachingDataStore = dataStore;
}
Also used : Blob(org.apache.jackrabbit.oak.api.Blob) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider) Hex.encodeHexString(org.apache.commons.codec.binary.Hex.encodeHexString) CountDownLatch(java.util.concurrent.CountDownLatch) FileInputStream(java.io.FileInputStream) List(java.util.List) ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser) FileUtils.copyInputStreamToFile(org.apache.commons.io.FileUtils.copyInputStreamToFile) File(java.io.File) AbstractSharedBackend(org.apache.jackrabbit.oak.spi.blob.AbstractSharedBackend)

Example 10 with DefaultStatisticsProvider

use of org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider in project jackrabbit-oak by apache.

the class CompositeDataStoreCacheTest method setup.

@Before
public void setup() throws Exception {
    LOG.info("Starting setup");
    root = folder.newFolder();
    loader = new TestCacheLoader<String, InputStream>(folder.newFolder());
    uploader = new TestStagingUploader(folder.newFolder());
    // create executor
    taskLatch = new CountDownLatch(1);
    callbackLatch = new CountDownLatch(1);
    afterExecuteLatch = new CountDownLatch(1);
    executor = new TestExecutor(1, taskLatch, callbackLatch, afterExecuteLatch);
    // stats
    ScheduledExecutorService statsExecutor = Executors.newSingleThreadScheduledExecutor();
    closer.register(new ExecutorCloser(statsExecutor, 500, TimeUnit.MILLISECONDS));
    statsProvider = new DefaultStatisticsProvider(statsExecutor);
    scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
    closer.register(new ExecutorCloser(scheduledExecutor, 500, TimeUnit.MILLISECONDS));
    fileCacheExecutor = sameThreadExecutor();
    //cache instance
    cache = new CompositeDataStoreCache(root.getAbsolutePath(), null, 80 * 1024, /* bytes */
    10, 1, /*threads*/
    loader, uploader, statsProvider, executor, scheduledExecutor, fileCacheExecutor, 3000, 6000);
    closer.register(cache);
    LOG.info("Finished setup");
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) InputStream(java.io.InputStream) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider) CountDownLatch(java.util.concurrent.CountDownLatch) ExecutorCloser(org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser) Before(org.junit.Before)

Aggregations

DefaultStatisticsProvider (org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider)20 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)15 Test (org.junit.Test)12 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)10 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)9 ExecutorCloser (org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser)6 SegmentGCOptions (org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions)6 StatisticsProvider (org.apache.jackrabbit.oak.stats.StatisticsProvider)6 File (java.io.File)5 HashSet (java.util.HashSet)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 Blob (org.apache.jackrabbit.oak.api.Blob)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 Random (java.util.Random)3 Callable (java.util.concurrent.Callable)2 ExecutorService (java.util.concurrent.ExecutorService)2 Future (java.util.concurrent.Future)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 FileStoreBuilder (org.apache.jackrabbit.oak.segment.file.FileStoreBuilder)2 FileStoreGCMonitor (org.apache.jackrabbit.oak.segment.file.FileStoreGCMonitor)2