|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.opencms.search.CmsIndexingThreadManager
Implements the management of indexing threads.
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
CmsIndexingThreadManager(I_CmsReport report,
long timeout,
java.lang.String indexName,
java.util.Map documentCache)
Creates and starts a thread manager for indexing threads. |
Method Summary | |
void |
addDocument(A_CmsIndexResource res,
java.lang.String locale,
org.apache.lucene.document.Document doc)
Caches the generated Document for the index resource to avoid multiple text extraction. |
void |
createIndexingThread(CmsObject cms,
org.apache.lucene.index.IndexWriter writer,
A_CmsIndexResource res,
CmsSearchIndex index)
Creates and starts a new indexing thread for a resource. |
void |
finished()
Signals the thread manager that a thread has finished its job and will exit immediately. |
int |
getCounter()
Gets the current thread (file) count. |
boolean |
isRunning()
Returns if the indexing manager still have indexing threads. |
void |
reportStatistics()
Writes statistical information to the report. |
void |
run()
Starts the thread manager to look for non-terminated threads The thread manager looks all 10 minutes if threads are not returned and reports the number to the log file. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public CmsIndexingThreadManager(I_CmsReport report, long timeout, java.lang.String indexName, java.util.Map documentCache)
report
- the report to write out progress informationtimeout
- timeout after a thread is abandonedindexName
- the name of the indexdocumentCache
- cache for storing indexed documents in (to avoid multiple text extraction)Method Detail |
public void addDocument(A_CmsIndexResource res, java.lang.String locale, org.apache.lucene.document.Document doc)
res
- the index resource to cache the Document forlocale
- the locale to chache the Document fotdoc
- the Document to cachepublic void createIndexingThread(CmsObject cms, org.apache.lucene.index.IndexWriter writer, A_CmsIndexResource res, CmsSearchIndex index)
After an indexing thread was started, the manager suspends itself
and waits for an amount of time specified by the timeout
value. If the timeout value is reached, the indexing thread is
aborted by an interrupt signal.
cms
- the cms objectwriter
- the write to write the indexres
- the resourceindex
- the indexpublic void finished()
public int getCounter()
public boolean isRunning()
public void reportStatistics()
The method reports the total number of threads started (equals to the number of indexed files), the number of returned threads (equals to the number of successfully indexed files), and the number of abandoned threads (hanging threads reaching the timeout).
public void run()
The thread manager looks all 10 minutes if threads are not returned and reports the number to the log file.
Runnable.run()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |