Hello,
I am trying to build index with the following code:
Code:
SimpleIndexingProgressMonitor sipm = new SimpleIndexingProgressMonitor(){
@Override
public void entitiesLoaded(int size) {
super.entitiesLoaded(size);
log.debug("Entities loaded: " + size);
}
@Override
public void indexingCompleted() {
super.indexingCompleted();
log.debug("Indexing finished.");
}
};
MassIndexer massIndexer = fullTextEntityManager.createIndexer(ReceptIndex.class)
.batchSizeToLoadObjects(1000)
.threadsForSubsequentFetching(8)
.threadsToLoadObjects(4)
.threadsForIndexWriter(3)
.cacheMode(CacheMode.IGNORE)
.progressMonitor(sipm)
.optimizeOnFinish(true);
massIndexer.startAndWait();
Everything works fine, but after the aplication returns from the method, some threads are probably still running in the background.
If I don't manually kill the application and try to build index again, I get exception because of the lock that is obtained for this index.
I would like to know, how to stop MassIndexer threads when indexing is completed. Am I missing something? If you need more details or code, I will post it.