Class DataIndexHelper.DataCrawlingThread

java.lang.Object
java.lang.Thread
org.codelibs.fess.helper.DataIndexHelper.DataCrawlingThread
All Implemented Interfaces:
Runnable
Enclosing class:
DataIndexHelper

protected static class DataIndexHelper.DataCrawlingThread extends Thread
Inner thread class for executing data store crawling operations. Each thread handles crawling for a single data configuration, processing documents and updating the search index.

The thread manages:

  • Data store initialization and document processing
  • Index update operations through callbacks
  • Error handling and failure logging
  • Cleanup of old documents after successful crawling
  • Field Details

    • finished

      protected boolean finished
      Flag indicating whether the crawling thread has finished execution
    • running

      protected boolean running
      Flag indicating whether the crawling thread is currently running
  • Constructor Details

    • DataCrawlingThread

      protected DataCrawlingThread(org.codelibs.fess.opensearch.config.exentity.DataConfig dataConfig, IndexUpdateCallback indexUpdateCallback, DataStoreParams initParamMap)
      Constructs a new data crawling thread.
      Parameters:
      dataConfig - configuration for the data store to crawl
      indexUpdateCallback - callback for handling document indexing
      initParamMap - initialization parameters for the data store
  • Method Details

    • run

      public void run()
      Executes the crawling thread. Sets the running flag, processes the data store, and ensures proper cleanup regardless of success or failure.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • process

      protected void process()
      Processes the data store crawling operation. This method initializes the data store, performs the crawling, handles any errors, and ensures cleanup operations are executed. After successful crawling, it commits the index updates and deletes old documents if configured to do so.
    • isFinished

      public boolean isFinished()
      Checks if the crawling thread has finished execution.
      Returns:
      true if the thread has completed its crawling operation
    • stopCrawling

      public void stopCrawling()
      Stops the crawling operation gracefully. If a data store is currently active, this method calls its stop method to halt the crawling process.
    • getCrawlingInfoId

      public String getCrawlingInfoId()
      Gets the crawling information ID for this thread.
      Returns:
      the crawling info ID from the initialization parameters
    • isRunning

      public boolean isRunning()
      Checks if the crawling thread is currently running.
      Returns:
      true if the thread is actively executing
    • awaitTermination

      public void awaitTermination()
      Waits for the crawling thread to terminate. This method blocks until the thread completes its execution. Interrupted exceptions are caught and logged at debug level.
    • awaitTermination

      public void awaitTermination(long mills)
      Waits for the crawling thread to terminate within a specified time limit. This method blocks until the thread completes or the timeout expires.
      Parameters:
      mills - maximum time to wait in milliseconds