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