private void registerObserver(Observable observable, Executor executor) { backgroundObserver = new BackgroundObserver(this, executor, 5); observerRegistration = observable.addObserver(backgroundObserver); }
private void registerObserver(Observable observable, Executor executor) { backgroundObserver = new BackgroundObserver(this, executor, 5); observerRegistration = observable.addObserver(backgroundObserver); }
/** * Default constructor which creates a BackgroundObserver automatically, including * creating a FilteringDispatcher. * @param executor the executor that should be used for the BackgroundObserver * @param queueLength the queue length of the BackgroundObserver * @param filter the Filter to be used for filtering * @param observer the FilteringAwareObserver to which content changes ultimately * are delivered after going through a chain of * FilteringObserver->BackgroundObserver->FilteringDispatcher. */ public FilteringObserver(@NotNull Executor executor, int queueLength, @NotNull Filter filter, @NotNull FilteringAwareObserver observer) { this(new BackgroundObserver(new FilteringDispatcher(checkNotNull(observer)), checkNotNull(executor), queueLength), filter); }
/** * Default constructor which creates a BackgroundObserver automatically, including * creating a FilteringDispatcher. * @param executor the executor that should be used for the BackgroundObserver * @param queueLength the queue length of the BackgroundObserver * @param filter the Filter to be used for filtering * @param observer the FilteringAwareObserver to which content changes ultimately * are delivered after going through a chain of * FilteringObserver->BackgroundObserver->FilteringDispatcher. */ public FilteringObserver(@NotNull Executor executor, int queueLength, @NotNull Filter filter, @NotNull FilteringAwareObserver observer) { this(new BackgroundObserver(new FilteringDispatcher(checkNotNull(observer)), checkNotNull(executor), queueLength), filter); }
/** * Default constructor which creates a BackgroundObserver automatically, including * creating a FilteringDispatcher. * @param executor the executor that should be used for the BackgroundObserver * @param queueLength the queue length of the BackgroundObserver * @param filter the Filter to be used for filtering * @param observer the FilteringAwareObserver to which content changes ultimately * are delivered after going through a chain of * FilteringObserver->BackgroundObserver->FilteringDispatcher. */ public FilteringObserver(@Nonnull Executor executor, int queueLength, @Nonnull Filter filter, @Nonnull FilteringAwareObserver observer) { this(new BackgroundObserver(new FilteringDispatcher(checkNotNull(observer)), checkNotNull(executor), queueLength), filter); }
@Activate protected void activate(ComponentContext componentContext) throws Exception { boolean enabled = PropertiesUtil.toBoolean(componentContext.getProperties().get(ENABLED), false); if (enabled) { BundleContext bundleContext = componentContext.getBundleContext(); Whiteboard whiteboard = new OsgiWhiteboard(bundleContext); executor = new WhiteboardExecutor(); executor.start(whiteboard); backgroundObserver = new BackgroundObserver(nodeStateSolrServersObserver, executor, 5); regs.add(bundleContext.registerService(Observer.class.getName(), backgroundObserver, null)); } }
@Activate protected void activate(ComponentContext componentContext) throws Exception { boolean enabled = PropertiesUtil.toBoolean(componentContext.getProperties().get(ENABLED), false); if (enabled) { BundleContext bundleContext = componentContext.getBundleContext(); Whiteboard whiteboard = new OsgiWhiteboard(bundleContext); executor = new WhiteboardExecutor(); executor.start(whiteboard); backgroundObserver = new BackgroundObserver(nodeStateSolrServersObserver, executor, 5); regs.add(bundleContext.registerService(Observer.class.getName(), backgroundObserver, null)); } }
private void registerObserver(BundleContext bundleContext, Map<String, ?> config) { boolean enableAsyncIndexOpen = PropertiesUtil.toBoolean(config.get(PROP_ASYNC_INDEX_OPEN), true); Observer observer = indexProvider; if (enableAsyncIndexOpen) { backgroundObserver = new BackgroundObserver(indexProvider, getExecutorService(), 5); observer = backgroundObserver; oakRegs.add(registerMBean(whiteboard, BackgroundObserverMBean.class, backgroundObserver.getMBean(), BackgroundObserverMBean.TYPE, "LuceneIndexConfigObserver queue stats")); log.info("Registering the LuceneIndexProvider as a BackgroundObserver"); } regs.add(bundleContext.registerService(Observer.class.getName(), observer, null)); }
private void registerObserver(BundleContext bundleContext, Map<String, ?> config) { boolean enableAsyncIndexOpen = PropertiesUtil.toBoolean(config.get(PROP_ASYNC_INDEX_OPEN), true); Observer observer = indexProvider; if (enableAsyncIndexOpen) { backgroundObserver = new BackgroundObserver(indexProvider, getExecutorService(), 5); observer = backgroundObserver; oakRegs.add(registerMBean(whiteboard, BackgroundObserverMBean.class, backgroundObserver.getMBean(), BackgroundObserverMBean.TYPE, "LuceneIndexConfigObserver queue stats")); log.info("Registering the LuceneIndexProvider as a BackgroundObserver"); } regs.add(bundleContext.registerService(Observer.class.getName(), observer, null)); }
private void registerObserver(Observer observer, Configuration config) { boolean enableAsyncObserver = config.enableAsyncObserver(); int queueSize = config.observerQueueSize(); if (enableAsyncObserver){ BackgroundObserver bgObserver = new BackgroundObserver(observer, executor, queueSize); oakRegs.add(registerMBean(whiteboard, BackgroundObserverMBean.class, bgObserver.getMBean(), BackgroundObserverMBean.TYPE, "Secondary NodeStore observer stats")); observer = bgObserver; log.info("Configuring the observer for secondary NodeStore as " + "Background Observer with queue size {}", queueSize); } //Ensure that our observer comes first in processing Hashtable<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_RANKING, 10000); regs.add(bundleContext.registerService(Observer.class.getName(), observer, props)); }
private void registerObserver(Observer observer, Configuration config) { boolean enableAsyncObserver = config.enableAsyncObserver(); int queueSize = config.observerQueueSize(); if (enableAsyncObserver){ BackgroundObserver bgObserver = new BackgroundObserver(observer, executor, queueSize); oakRegs.add(registerMBean(whiteboard, BackgroundObserverMBean.class, bgObserver.getMBean(), BackgroundObserverMBean.TYPE, "Secondary NodeStore observer stats")); observer = bgObserver; log.info("Configuring the observer for secondary NodeStore as " + "Background Observer with queue size {}", queueSize); } //Ensure that our observer comes first in processing Hashtable<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_RANKING, 10000); regs.add(bundleContext.registerService(Observer.class.getName(), observer, props)); }
return new BackgroundObserver(new Observer() {
@Override public Jcr customize(Oak oak) { Jcr jcr = new Jcr(oak); whiteboard = oak.getWhiteboard(); prepareLuceneIndexer(workDir, getNodeStore(oak)); backgroundObserver = new BackgroundObserver(luceneIndexProvider, executorService, 5); jcr.with((QueryIndexProvider) luceneIndexProvider) .with(backgroundObserver) .with(luceneEditorProvider) .with(new NodeTypeIndexFixerInitializer()); if (hybridIndexEnabled) { jcr.with(localIndexObserver); indexInitializer = new LuceneIndexInitializer(); } jcr.with(indexInitializer); //Configure the default global fulltext index as it impacts //both pure property index based setup and nrt based //So more closer to real world jcr.with(new LuceneFullTextInitializer()); //Async indexing is enabled for both property and lucene //as for property it relies on counter index oak.withAsyncIndexing("async", asyncInterval); return jcr; } });