Package org.codelibs.fess.helper
Class DataIndexHelper.DataCrawlingThread
java.lang.Object
java.lang.Thread
org.codelibs.fess.helper.DataIndexHelper.DataCrawlingThread
- All Implemented Interfaces:
Runnable
- Enclosing class:
DataIndexHelper
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanFlag indicating whether the crawling thread has finished executionprotected booleanFlag indicating whether the crawling thread is currently runningFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataCrawlingThread(org.codelibs.fess.opensearch.config.exentity.DataConfig dataConfig, IndexUpdateCallback indexUpdateCallback, DataStoreParams initParamMap) Constructs a new data crawling thread. -
Method Summary
Modifier and TypeMethodDescriptionvoidWaits for the crawling thread to terminate.voidawaitTermination(long mills) Waits for the crawling thread to terminate within a specified time limit.Gets the crawling information ID for this thread.booleanChecks if the crawling thread has finished execution.booleanChecks if the crawling thread is currently running.protected voidprocess()Processes the data store crawling operation.voidrun()Executes the crawling thread.voidStops the crawling operation gracefully.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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
finished
protected boolean finishedFlag indicating whether the crawling thread has finished execution -
running
protected boolean runningFlag 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 crawlindexUpdateCallback- callback for handling document indexinginitParamMap- 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. -
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
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
-