Search in sources :

Example 1 with LuceneJournalPropertyService

use of org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LuceneJournalPropertyService 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);
}
Also used : ExternalObserverBuilder(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.ExternalObserverBuilder) LocalIndexObserver(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) LocalIndexObserver(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver) BackgroundObserver(org.apache.jackrabbit.oak.spi.commit.BackgroundObserver) DocumentQueue(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue) LuceneJournalPropertyService(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LuceneJournalPropertyService) BackgroundObserverMBean(org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)

Aggregations

DocumentQueue (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue)1 ExternalObserverBuilder (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.ExternalObserverBuilder)1 LocalIndexObserver (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver)1 LuceneJournalPropertyService (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LuceneJournalPropertyService)1 BackgroundObserver (org.apache.jackrabbit.oak.spi.commit.BackgroundObserver)1 BackgroundObserverMBean (org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)1 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)1