Class CmsIndexingThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class CmsIndexingThread
    extends java.lang.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

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected I_CmsSearchDocument createDefaultIndexDocument()
      Creates a document for the resource without extracting the content.
      protected I_CmsSearchDocument createIndexDocument​(CmsObject cms, CmsResource res, I_CmsSearchIndex index, int count, I_CmsReport report)
      Creates the search index document.
      I_CmsSearchDocument 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, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, 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,
                                 I_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 I_CmsSearchDocument 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 java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
        See Also:
        Runnable.run()
      • createDefaultIndexDocument

        protected I_CmsSearchDocument createDefaultIndexDocument()
        Creates a document for the resource without extracting the content. The aim is to get a content indexed, even if extraction runs into a timeout.
        Returns:
        the document for the resource generated if the content is discarded, i.e., only meta information are indexed.