@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()); }
@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()); }
@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()); }
@Test public void testLeaseDisabled() throws Exception { // take care of initial reindex before AsyncIndexUpdate async = new AsyncIndexUpdate(name, store, provider).setLeaseTimeOut(0); async.run(); testContent(store); assertRunOk(async); testContent(store); assertRunOk(async); executed.set(true); }