use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class LuceneIndexDescendantSpellcheckTest method before.
@Before
public void before() throws Exception {
LuceneIndexProvider provider = new LuceneIndexProvider();
Jcr jcr = new Jcr().with(((QueryIndexProvider) provider)).with((Observer) provider).with(new LuceneIndexEditorProvider());
repository = jcr.createRepository();
session = (JackrabbitSession) repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
root = session.getRootNode();
createContent();
session.save();
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class CheckpointTest method noContentChangeForCheckpoints.
@Test
public void noContentChangeForCheckpoints() throws Exception {
final AtomicInteger invocationCount = new AtomicInteger();
((Observable) store).addObserver(new Observer() {
@Override
public void contentChanged(@Nonnull NodeState root, @Nonnull CommitInfo info) {
invocationCount.incrementAndGet();
}
});
invocationCount.set(0);
String cp = store.checkpoint(Long.MAX_VALUE);
assertEquals(0, invocationCount.get());
store.release(cp);
assertEquals(0, invocationCount.get());
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class HybridIndexClusterIT method customize.
@Override
protected Jcr customize(Jcr jcr) {
IndexCopier copier;
try {
copier = new IndexCopier(executorService, temporaryFolder.getRoot());
} catch (IOException e) {
throw new RuntimeException(e);
}
MountInfoProvider mip = defaultMountInfoProvider();
NRTIndexFactory nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
LuceneIndexProvider provider = new LuceneIndexProvider(tracker);
DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, tracker, null, null, mip);
editorProvider.setIndexingQueue(queue);
LocalIndexObserver localIndexObserver = new LocalIndexObserver(queue, StatisticsProvider.NOOP);
ExternalIndexObserver externalIndexObserver = new ExternalIndexObserver(queue, tracker, StatisticsProvider.NOOP);
QueryEngineSettings qs = new QueryEngineSettings();
qs.setFailTraversal(true);
jcr.with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(externalIndexObserver).with(editorProvider).with(qs).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
return jcr;
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class LuceneIndexSuggestionTest method before.
@Before
public void before() throws Exception {
LuceneIndexProvider provider = new LuceneIndexProvider();
Jcr jcr = new Jcr().with(((QueryIndexProvider) provider)).with((Observer) provider).with(new LuceneIndexEditorProvider());
repository = jcr.createRepository();
session = (JackrabbitSession) repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
root = session.getRootNode();
}
use of org.apache.jackrabbit.oak.spi.commit.Observer 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);
}
Aggregations