code: @SuppressWarnings("unchecked")
     void dispose()
     {
        log.debug("dispose IndexMerger");
        // get mutex for index replacements
        try
        {
           indexReplacement.acquire();
        }
        catch (InterruptedException e)
        {
           log.warn("Interrupted while acquiring index replacement sync: " + e);
           // try to stop IndexMerger without the sync
        }
  
        // clear task queue
        mergeTasks.clear();
  
        // send quit
        mergeTasks.add(QUIT);
        log.debug("quit sent");
  
        try
        {
           // give the merger thread some time to quit,
           // it is possible that the merger is busy working on a large index.
           // if that is the case we will just ignore it and the daemon will
           // die without being able to finish the merge.
           // at this point it is not possible anymore to replace indexes
           // on the MultiIndex because we hold the indexReplacement Sync.
           this.join(500);
           if (isAlive())
           {
              log.info("Unable to stop IndexMerger. Daemon is busy.");
           }
           else
           {
              log.debug("IndexMerger thread stopped");
           }
           log.debug("merge queue size: " + mergeTasks.size());
        }
        catch (InterruptedException e)
        {
           log.warn("Interrupted while waiting for IndexMerger thread to terminate.");
        }
     }
docs: Signals this <code>IndexMerger</code> to stop and waits until it
  has terminated.