com.atlassian.bonnie.index
Class BaseMultiThreadedIndexer
java.lang.Object
com.atlassian.bonnie.index.BaseMultiThreadedIndexer
- All Implemented Interfaces:
- BatchOpIndexer
- Direct Known Subclasses:
- OnlineMultiThreadedIndexer
public abstract class BaseMultiThreadedIndexer
- extends java.lang.Object
- implements BatchOpIndexer
Multiple-thread implementation of a BatchOpIndexer
|
Method Summary |
protected abstract void |
allThreadsComplete(BatchOpIndexer.DocumentWritingScheme scheme,
boolean truncate,
com.atlassian.core.util.ProgressWrapper progress)
Perform clean-up operations such as closing writers, optimizing, merging with original index, etc. |
protected int |
calculateNumberOfThreads(int numObjects)
Determine how many threads to use. |
protected java.lang.Runnable |
getQueueProcessingRunnable(ObjectQueue queue,
BatchOpIndexer.DocumentWritingScheme documentWritingScheme)
|
protected boolean |
isReindexing()
Is reindexing currently underway? Distinct from LuceneConnection.isReIndexing()
in that this method is for internal use, whilst the LuceneConnection equivalent is for all potential users
of the index, whether in- or out-of-process clients. |
void |
reindex(ObjectQueue queue,
BatchOpIndexer.DocumentWritingScheme documentWritingScheme,
com.atlassian.core.util.ProgressMeter meter,
boolean truncate)
Indexes objects in batch. |
void |
setReindexing(boolean reindexing)
|
void |
truncateIndex()
Truncate the index. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.log4j.Category log
luceneConnection
protected LuceneConnection luceneConnection
BaseMultiThreadedIndexer
public BaseMultiThreadedIndexer()
reindex
public final void reindex(ObjectQueue queue,
BatchOpIndexer.DocumentWritingScheme documentWritingScheme,
com.atlassian.core.util.ProgressMeter meter,
boolean truncate)
- Description copied from interface:
BatchOpIndexer
- Indexes objects in batch.
- Specified by:
reindex in interface BatchOpIndexer
- Parameters:
queue - queue of objects to indexdocumentWritingScheme - document writing scheme to usemeter - progress meter indicating index progresstruncate - should the original index be truncated?
getQueueProcessingRunnable
protected java.lang.Runnable getQueueProcessingRunnable(ObjectQueue queue,
BatchOpIndexer.DocumentWritingScheme documentWritingScheme)
truncateIndex
public void truncateIndex()
throws java.io.IOException
- Description copied from interface:
BatchOpIndexer
- Truncate the index. Depending on implementations, this can mean deleting the documents one by one,
or other more efficient ways of removing documents from the index. Either way, this method results in an
empty (but valid) Lucene index.
- Specified by:
truncateIndex in interface BatchOpIndexer
- Throws:
java.io.IOException
allThreadsComplete
protected abstract void allThreadsComplete(BatchOpIndexer.DocumentWritingScheme scheme,
boolean truncate,
com.atlassian.core.util.ProgressWrapper progress)
- Perform clean-up operations such as closing writers, optimizing, merging with original index, etc.
- Parameters:
scheme - schemetruncate - should the original index be truncated
calculateNumberOfThreads
protected int calculateNumberOfThreads(int numObjects)
- Determine how many threads to use.
- Parameters:
numObjects - the number of objects to index
- Returns:
- number of threads
isReindexing
protected boolean isReindexing()
- Is reindexing currently underway? Distinct from
LuceneConnection.isReIndexing()
in that this method is for internal use, whilst the LuceneConnection equivalent is for all potential users
of the index, whether in- or out-of-process clients.
- Returns:
- true if the reindex method is currently running.
setReindexing
public void setReindexing(boolean reindexing)
Copyright © 2006-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.