use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class ObservationTest method run.
@Override
public void run(Iterable<RepositoryFixture> fixtures) {
for (RepositoryFixture fixture : fixtures) {
if (fixture.isAvailable(1)) {
System.out.format("%s: Observation throughput benchmark%n", fixture);
try {
final AtomicReference<Whiteboard> whiteboardRef = new AtomicReference<Whiteboard>();
Repository[] cluster;
if (fixture instanceof OakRepositoryFixture) {
cluster = ((OakRepositoryFixture) fixture).setUpCluster(1, new JcrCreator() {
@Override
public Jcr customize(Oak oak) {
whiteboardRef.set(oak.getWhiteboard());
return new Jcr(oak);
}
});
} else {
cluster = fixture.setUpCluster(1);
}
try {
run(cluster[0], whiteboardRef.get());
} finally {
fixture.tearDownCluster();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class AtomicCounterEditorTest method singleNodeAsync.
@Test
public void singleNodeAsync() throws CommitFailedException, InterruptedException, ExecutionException {
NodeStore store = new MemoryNodeStore();
MyExecutor exec1 = new MyExecutor();
Whiteboard board = new DefaultWhiteboard();
EditorHook hook1 = new EditorHook(new TestableACEProvider(CLUSTER_1, exec1, store, board));
NodeBuilder builder, root;
PropertyState p;
board.register(CommitHook.class, EmptyHook.INSTANCE, null);
root = store.getRoot().builder();
builder = root.child("c");
builder = setMixin(builder);
builder = incrementBy(builder, INCREMENT_BY_1);
store.merge(root, hook1, CommitInfo.EMPTY);
// as we're providing all the information we expect the counter not to be consolidated for
// as long as the scheduled process has run
builder = store.getRoot().builder().getChildNode("c");
assertTrue(builder.exists());
p = builder.getProperty(PREFIX_PROP_REVISION + CLUSTER_1.getInstanceId());
assertNotNull(p);
assertEquals(1, p.getValue(LONG).longValue());
p = builder.getProperty(PREFIX_PROP_COUNTER + CLUSTER_1.getInstanceId());
assertNotNull(p);
assertEquals(1, p.getValue(LONG).longValue());
p = builder.getProperty(PROP_COUNTER);
assertNull(p);
// executing the consolidation
exec1.execute();
// fetching the latest store state to see the changes
builder = store.getRoot().builder().getChildNode("c");
assertTrue("the counter node should exists", builder.exists());
assertCounterNodeState(builder, ImmutableSet.of(PREFIX_PROP_COUNTER + CLUSTER_1.getInstanceId(), PREFIX_PROP_REVISION + CLUSTER_1.getInstanceId()), 1);
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class AtomicCounterEditorTest method noHookInWhiteboard.
@Test
public void noHookInWhiteboard() throws CommitFailedException, InterruptedException, ExecutionException {
NodeStore store = new MemoryNodeStore();
MyExecutor exec1 = new MyExecutor();
Whiteboard board = new DefaultWhiteboard();
EditorHook hook1 = new EditorHook(new TestableACEProvider(CLUSTER_1, exec1, store, board));
NodeBuilder builder, root;
PropertyState p;
root = store.getRoot().builder();
builder = root.child("c");
builder = setMixin(builder);
builder = incrementBy(builder, INCREMENT_BY_1);
store.merge(root, hook1, CommitInfo.EMPTY);
// as we're providing all the information we expect the counter not to be consolidated for
// as long as the scheduled process has run
builder = store.getRoot().builder().getChildNode("c");
assertTrue(builder.exists());
p = builder.getProperty(PREFIX_PROP_REVISION + CLUSTER_1.getInstanceId());
assertNotNull(p);
assertEquals(1, p.getValue(LONG).longValue());
p = builder.getProperty(PREFIX_PROP_COUNTER + CLUSTER_1.getInstanceId());
assertNotNull(p);
assertEquals(1, p.getValue(LONG).longValue());
p = builder.getProperty(PROP_COUNTER);
assertEquals(1, p.getValue(LONG).longValue());
assertTrue("without a registered hook it should have fell to sync", exec1.isEmpty());
// fetching the latest store state to see the changes
builder = store.getRoot().builder().getChildNode("c");
assertTrue("the counter node should exists", builder.exists());
assertCounterNodeState(builder, ImmutableSet.of(PREFIX_PROP_COUNTER + CLUSTER_1.getInstanceId(), PREFIX_PROP_REVISION + CLUSTER_1.getInstanceId()), 1);
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class ConsolidatedDataStoreCacheStats method activate.
@Activate
private void activate(BundleContext context) {
Whiteboard wb = new OsgiWhiteboard(context);
List<DataStoreCacheStatsMBean> allStats = cachingDataStore.getStats();
for (DataStoreCacheStatsMBean stat : allStats) {
registrations.add(registerMBean(wb, CacheStatsMBean.class, stat, CacheStatsMBean.TYPE, stat.getName()));
cacheStats.add(stat);
}
registrations.add(registerMBean(wb, ConsolidatedDataStoreCacheStatsMBean.class, this, ConsolidatedDataStoreCacheStatsMBean.TYPE, "Consolidated DataStore Cache statistics"));
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class BlobMigration method activate.
@Activate
private void activate(BundleContext ctx) {
Whiteboard wb = new OsgiWhiteboard(ctx);
migrator = new BlobMigrator((SplitBlobStore) splitBlobStore, nodeStore);
mbeanReg = registerMBean(wb, BlobMigrationMBean.class, this, BlobMigrationMBean.TYPE, OP_NAME);
}
Aggregations