org.apache.lucene.index
Class ConcurrentMergeScheduler

java.lang.Object
  extended by org.apache.lucene.index.MergeScheduler
      extended by org.apache.lucene.index.ConcurrentMergeScheduler

public class ConcurrentMergeScheduler
extends MergeScheduler

A MergeScheduler that runs each merge using a separate thread, up until a maximum number of threads (setMaxThreadCount(int)) at which points merges are run in the foreground, serially. This is a simple way to use concurrency in the indexing process without having to create and manage application level threads.


Constructor Summary
ConcurrentMergeScheduler()
           
 
Method Summary
static boolean anyUnhandledExceptions()
          Used for testing
 void close()
          Close this MergeScheduler.
 int getMaxThreadCount()
          Get the max # simultaneous threads that may be running.
 int getMergeThreadPriority()
          Return the priority that merge threads run at.
 void merge(IndexWriter writer)
          Run the merges provided by IndexWriter.getNextMerge().
 void setMaxThreadCount(int count)
          Sets the max # simultaneous threads that may be running.
 void setMergeThreadPriority(int pri)
          Return the priority that merge threads run at.
static void setTestMode()
           
 void sync()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentMergeScheduler

public ConcurrentMergeScheduler()
Method Detail

setMaxThreadCount

public void setMaxThreadCount(int count)
Sets the max # simultaneous threads that may be running. If a merge is necessary yet we already have this many threads running, the merge is returned back to IndexWriter so that it runs in the "foreground".


getMaxThreadCount

public int getMaxThreadCount()
Get the max # simultaneous threads that may be running. @see #setMaxThreadCount.


getMergeThreadPriority

public int getMergeThreadPriority()
Return the priority that merge threads run at. By default the priority is 1 plus the priority of (ie, slightly higher priority than) the first thread that calls merge.


setMergeThreadPriority

public void setMergeThreadPriority(int pri)
Return the priority that merge threads run at.


close

public void close()
Description copied from class: MergeScheduler
Close this MergeScheduler.


sync

public void sync()

merge

public void merge(IndexWriter writer)
           throws CorruptIndexException,
                  IOException
Description copied from class: MergeScheduler
Run the merges provided by IndexWriter.getNextMerge().

Throws:
CorruptIndexException
IOException

anyUnhandledExceptions

public static boolean anyUnhandledExceptions()
Used for testing


setTestMode

public static void setTestMode()


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.