use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class AsyncIndexerService method activate.
@Activate
public void activate(BundleContext bundleContext, Map<String, Object> config) {
List<AsyncConfig> asyncIndexerConfig = getAsyncConfig(PropertiesUtil.toStringArray(config.get(PROP_ASYNC_CONFIG), new String[0]));
Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
indexRegistration = new IndexMBeanRegistration(whiteboard);
indexEditorProvider.start(whiteboard);
executor = new WhiteboardExecutor();
executor.start(whiteboard);
long leaseTimeOutMin = PropertiesUtil.toInteger(config.get(PROP_LEASE_TIME_OUT), PROP_LEASE_TIMEOUT_DEFAULT);
if (!(nodeStore instanceof Clusterable)) {
leaseTimeOutMin = 0;
log.info("Detected non clusterable setup. Lease checking would be disabled for async indexing");
}
TrackingCorruptIndexHandler corruptIndexHandler = createCorruptIndexHandler(config);
for (AsyncConfig c : asyncIndexerConfig) {
AsyncIndexUpdate task = new AsyncIndexUpdate(c.name, nodeStore, indexEditorProvider, statisticsProvider, false);
task.setCorruptIndexHandler(corruptIndexHandler);
task.setValidatorProviders(Collections.singletonList(validatorProvider));
task.setLeaseTimeOut(TimeUnit.MINUTES.toMillis(leaseTimeOutMin));
indexRegistration.registerAsyncIndexer(task, c.timeIntervalInSecs);
closer.register(task);
}
registerAsyncReindexSupport(whiteboard);
log.info("Configured async indexers {} ", asyncIndexerConfig);
log.info("Lease time: {} mins and AsyncIndexUpdate configured with {}", leaseTimeOutMin, validatorProvider.getClass().getName());
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class OakTest method checkMissingStrategySetting.
@Test(expected = CommitFailedException.class)
public void checkMissingStrategySetting() throws Exception {
Whiteboard wb = new DefaultWhiteboard();
WhiteboardIndexEditorProvider wbProvider = new WhiteboardIndexEditorProvider();
wbProvider.start(wb);
Registration r1 = wb.register(IndexEditorProvider.class, new PropertyIndexEditorProvider(), null);
Registration r2 = wb.register(IndexEditorProvider.class, new ReferenceEditorProvider(), null);
Oak oak = new Oak().with(new OpenSecurityProvider()).with(new InitialContent()).with(wb).with(wbProvider).withFailOnMissingIndexProvider();
ContentRepository repo = oak.createContentRepository();
ContentSession cs = repo.login(null, null);
Root root = cs.getLatestRoot();
Tree t = root.getTree("/");
t.setProperty("foo", "u1", Type.REFERENCE);
r1.unregister();
root.commit();
cs.close();
((Closeable) repo).close();
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class InternalSecurityProviderTest method testSetWhiteboard.
@Test
public void testSetWhiteboard() {
Whiteboard wb = new DefaultWhiteboard();
securityProvider.setWhiteboard(wb);
assertSame(wb, securityProvider.getWhiteboard());
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class ObservationQueueTest method heavyLoad.
@Test
public void heavyLoad() throws Throwable {
List<Whiteboard> whiteboards = Lists.newArrayList(w1, w2);
Iterator<Repository> repos = Iterators.cycle(r1, r2);
AtomicLong commitCounter = new AtomicLong();
for (int i = 0; i < NUM_WRITERS; i++) {
Session s = loginUser(repos.next());
Node n = s.getRootNode().addNode("session-" + i, "oak:Unstructured");
s.save();
writers.add(new Thread(new Writer(n, commitCounter)));
}
for (int i = 0; i < NUM_READERS; i++) {
Session s = loginUser(repos.next());
readers.add(new Thread(new Reader(s)));
}
AtomicInteger queueLength = new AtomicInteger();
loggers.add(new Thread(new QueueLogger(whiteboards, queueLength, commitCounter)));
for (int i = 0; i < NUM_OBSERVERS; i++) {
Session s = loginUser(repos.next());
observers.add(new Thread(new Observer(s, queueLength)));
}
for (Thread t : Iterables.concat(writers, readers, observers, loggers)) {
t.start();
}
for (Thread t : Iterables.concat(writers, readers)) {
t.join();
}
LOG.info("Writes stopped. Waiting for observers...");
for (Thread t : Iterables.concat(observers, loggers)) {
t.join();
}
for (Throwable t : exceptions) {
throw t;
}
}
use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.
the class RefreshOnGCTest method setup.
@Before
public void setup() throws Exception {
File directory = createTempFile(getClass().getSimpleName(), "test", new File("target"));
directory.delete();
directory.mkdir();
Whiteboard whiteboard = new DefaultWhiteboard();
gcMonitor = new GCMonitorTracker();
gcMonitor.start(whiteboard);
Oak oak = new Oak(createSegmentTarStore(directory, gcMonitor));
oak.with(whiteboard);
repository = new Jcr(oak).createRepository();
}
Aggregations