Here is my setup currently;
1 Thread which has an open FullTextSession, and does something like this:
Code:
transaction = fts.beginTransaction();
fts.setCacheMode(CacheMode.IGNORE);
fts.setFlushMode(FlushMode.MANUAL);
while(true) {
if(queue.peek() != null) {
Object item = this.queue.poll();
fts.lock(item,LockMode.NONE);
fts.index(item);
count++;
if(count % BATCH_SIZE == 0) {
fts.flushToIndexes();
fts.clear();
}
//some code to break out of the loop
}
}
fts.flushToIndexes();
transaction.commit();
fts.close;
I have a threadpool (ExecutorService) that is comprised of producer classes that do nothing other than retrieve objects and stick them into the queue (ConcurrentLinkedQueue) for the Indexer.
When I have async disabled, I get the correct document count when I open the index up in Luke. Using the same code and only changing the execution mode to async, the index builds with roughly half the document count it should have. I have that count printing out, so I know the indexer has passed all the objects to the index, so where is it getting dropped?
Any help would be appreciated! Turning async on, even though its only doing half the work, its easily 4-5x faster than with it off atm, so I very much would like to use it.