org.opencms.search
Class CmsIndexingThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.opencms.search.CmsIndexingThread
All Implemented Interfaces:
Runnable

public class CmsIndexingThread
extends Thread

Implements the indexing method for a single resource as thread.

The indexing of a single resource is wrapped into a thread in order to prevent the overall indexer from hanging.

Since:
6.0.0

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CmsIndexingThread(CmsObject cms, CmsResource res, CmsSearchIndex index, int count, I_CmsReport report)
          Create a new indexing thread.
 
Method Summary
protected  org.apache.lucene.document.Document createIndexDocument(CmsObject cms, CmsResource res, CmsSearchIndex index, int count, I_CmsReport report)
          Creates the search index document.
 org.apache.lucene.document.Document getResult()
          Returns the document created by this indexer thread.
 void run()
          Starts the thread to index a single resource.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsIndexingThread

public CmsIndexingThread(CmsObject cms,
                         CmsResource res,
                         CmsSearchIndex index,
                         int count,
                         I_CmsReport report)
Create a new indexing thread.

Parameters:
cms - the current OpenCms user context
res - the resource to index
index - the index to update the resource in
count - the report count
report - the report to write the output to
Method Detail

getResult

public org.apache.lucene.document.Document getResult()
Returns the document created by this indexer thread.

In case the resource could not be indexed, null is returned.

Returns:
the document created by this indexer thread

run

public void run()
Starts the thread to index a single resource.

Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Runnable.run()

createIndexDocument

protected org.apache.lucene.document.Document createIndexDocument(CmsObject cms,
                                                                  CmsResource res,
                                                                  CmsSearchIndex index,
                                                                  int count,
                                                                  I_CmsReport report)
                                                           throws CmsException
Creates the search index document.

Parameters:
cms - the current OpenCms user context
res - the resource to index
index - the index to update the resource in
count - the report count
report - the report to write the output to
Returns:
the created search index document
Throws:
CmsException - in case of issues while creating the search index document