org.infinispan.query.indexmanager.LazyInitializingBackend Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinispan-embedded-query
Show all versions of infinispan-embedded-query
Infinispan Embedded Query All-in-One module
The newest version!
package org.infinispan.query.indexmanager;
import java.util.List;
import org.hibernate.search.backend.IndexingMonitor;
import org.hibernate.search.backend.LuceneWork;
import org.hibernate.search.indexes.spi.IndexManager;
/**
* This backend only triggers initialization of a different backend when
* incoming indexing operations trigger it, then transfers the incoming
* operations to the new backend.
* Which backed is being selected depends on the cluster state.
*
* @author Sanne Grinovero (C) 2014 Red Hat Inc.
* @since 7.0
*/
public class LazyInitializingBackend implements IndexingBackend {
private final LazyInitializableBackend backend;
public LazyInitializingBackend(LazyInitializableBackend backend) {
this.backend = backend;
}
@Override
public void applyWork(List workList, IndexingMonitor monitor, IndexManager indexManager) {
backend.lazyInitialize();
backend.getCurrentIndexingBackend().applyWork(workList, monitor, indexManager);
}
@Override
public void applyStreamWork(LuceneWork singleOperation, IndexingMonitor monitor, IndexManager indexManager) {
backend.lazyInitialize();
backend.getCurrentIndexingBackend().applyStreamWork(singleOperation, monitor, indexManager);
}
@Override
public boolean isMasterLocal() {
// Avoid initializing yet
return false;
}
@Override
public void flushAndClose(IndexingBackend replacement) {
//no-op: this is essentially stateless
}
public String toString() {
return "LazyInitializingBackend";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy