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());
}
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);
}
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());
}
Aggregations