Search in sources :

Example 1 with Clusterable

use of org.apache.jackrabbit.oak.spi.state.Clusterable in project jackrabbit-oak by apache.

the class AsyncIndexerService method activate.

@Activate
public void activate(BundleContext bundleContext, Configuration config) {
    List<AsyncConfig> asyncIndexerConfig = getAsyncConfig(config.asyncConfigs());
    Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
    indexRegistration = new IndexMBeanRegistration(whiteboard);
    indexEditorProvider.start(whiteboard);
    executor = new WhiteboardExecutor();
    executor.start(whiteboard);
    long leaseTimeOutMin = config.leaseTimeOutMinutes();
    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());
}
Also used : Clusterable(org.apache.jackrabbit.oak.spi.state.Clusterable) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) WhiteboardExecutor(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with Clusterable

use of org.apache.jackrabbit.oak.spi.state.Clusterable in project jackrabbit-oak by apache.

the class LuceneIndexProviderService method registerPropertyIndexCleaner.

private void registerPropertyIndexCleaner(Map<String, ?> config, BundleContext bundleContext) {
    int cleanerInterval = PropertiesUtil.toInteger(config.get(PROP_INDEX_CLEANER_INTERVAL), PROP_INDEX_CLEANER_INTERVAL_DEFAULT);
    if (cleanerInterval <= 0) {
        log.info("Property index cleaner would not be registered");
        return;
    }
    cleaner = new PropertyIndexCleaner(nodeStore, indexPathService, asyncIndexInfoService, statisticsProvider);
    // Proxy check for DocumentNodeStore
    if (nodeStore instanceof Clusterable) {
        cleaner.setRecursiveDelete(true);
        log.info("PropertyIndexCleaner configured to perform recursive delete");
    }
    oakRegs.add(scheduleWithFixedDelay(whiteboard, cleaner, ImmutableMap.of("scheduler.name", PropertyIndexCleaner.class.getName()), cleanerInterval, true, true));
    log.info("Property index cleaner configured to run every [{}] seconds", cleanerInterval);
}
Also used : Clusterable(org.apache.jackrabbit.oak.spi.state.Clusterable) PropertyIndexCleaner(org.apache.jackrabbit.oak.plugins.index.lucene.property.PropertyIndexCleaner)

Example 3 with Clusterable

use of org.apache.jackrabbit.oak.spi.state.Clusterable 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());
}
Also used : Clusterable(org.apache.jackrabbit.oak.spi.state.Clusterable) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) WhiteboardExecutor(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

Clusterable (org.apache.jackrabbit.oak.spi.state.Clusterable)3 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)2 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)2 WhiteboardExecutor (org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor)2 Activate (org.apache.felix.scr.annotations.Activate)1 PropertyIndexCleaner (org.apache.jackrabbit.oak.plugins.index.lucene.property.PropertyIndexCleaner)1 Activate (org.osgi.service.component.annotations.Activate)1