use of org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.ExternalObserverBuilder in project jackrabbit-oak by apache.
the class LuceneIndexProviderService method registerLocalIndexObserver.
private void registerLocalIndexObserver(BundleContext bundleContext, IndexTracker tracker, Map<String, ?> config) {
if (!hybridIndex) {
log.info("Hybrid indexing feature disabled");
return;
}
int queueSize = PropertiesUtil.toInteger(config.get(PROP_HYBRID_QUEUE_SIZE), PROP_HYBRID_QUEUE_SIZE_DEFAULT);
documentQueue = new DocumentQueue(queueSize, tracker, getExecutorService(), statisticsProvider);
LocalIndexObserver localIndexObserver = new LocalIndexObserver(documentQueue, statisticsProvider);
regs.add(bundleContext.registerService(Observer.class.getName(), localIndexObserver, null));
int observerQueueSize = 1000;
int builderMaxSize = 5000;
regs.add(bundleContext.registerService(JournalPropertyService.class.getName(), new LuceneJournalPropertyService(builderMaxSize), null));
ExternalObserverBuilder builder = new ExternalObserverBuilder(documentQueue, tracker, statisticsProvider, getExecutorService(), observerQueueSize);
log.info("Configured JournalPropertyBuilder with max size {} and backed by BackgroundObserver " + "with queue size {}", builderMaxSize, observerQueueSize);
Observer observer = builder.build();
externalIndexObserver = builder.getBackgroundObserver();
regs.add(bundleContext.registerService(Observer.class.getName(), observer, null));
oakRegs.add(registerMBean(whiteboard, BackgroundObserverMBean.class, externalIndexObserver.getMBean(), BackgroundObserverMBean.TYPE, "LuceneExternalIndexObserver queue stats"));
log.info("Hybrid indexing enabled for configured indexes with queue size of {}", queueSize);
}
Aggregations