/**
* Schedules a background task for flushing the index once per second.
*/
private void scheduleFlushTask() {
ScheduledExecutorService executor = handler.getContext().getExecutor();
flushTask = executor.scheduleWithFixedDelay(new Runnable() {
public void run() {
// check if there are any indexing jobs finished
checkIndexingQueue(false);
// check if volatile index should be flushed
checkFlush();