Package org.codelibs.fess.job
Class CrawlJob
java.lang.Object
org.codelibs.fess.job.ExecJob
org.codelibs.fess.job.CrawlJob
CrawlJob is responsible for executing the crawling process in Fess.
This job launches a separate crawler process that can crawl web sites, file systems,
and data sources based on the configured crawling settings.
The job supports selective crawling by specifying configuration IDs for different types of crawlers (web, file, data). It manages the crawler process lifecycle, handles timeout scenarios, and ensures proper cleanup of resources.
Key features:
- Concurrent crawler process management with configurable limits
- Selective crawling based on configuration IDs
- Document expiration handling
- Hot thread monitoring for performance analysis
- Process isolation with separate JVM
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]Array of data source crawling configuration IDs to process.protected intDocument expiration setting in days.protected String[]Array of file system crawling configuration IDs to process.protected intHot thread monitoring interval in seconds.protected StringThe namespace identifier for the crawling session.protected String[]Array of web crawling configuration IDs to process.Fields inherited from class org.codelibs.fess.job.ExecJob
jobExecutor, jvmOptions, lastaEnv, logFilePath, logLevel, logSuffix, processTimeout, sessionId, timeout, useLocalFesen -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataConfigIds(String[] dataConfigIds) Sets the data source crawling configuration IDs to process.documentExpires(int documentExpires) Sets the document expiration period in days.execute()Executes the job and returns the result as a string.protected voidExecutes the crawler process in a separate JVM.fileConfigIds(String[] fileConfigIds) Sets the file system crawling configuration IDs to process.protected StringReturns the execution type identifier for this job.protected intGets the count of currently running crawler jobs.hotThread(int hotThreadInterval) Sets the hot thread monitoring interval for performance analysis.Sets the namespace for the crawling session.webConfigIds(String[] webConfigIds) Sets the web crawling configuration IDs to process.Methods inherited from class org.codelibs.fess.job.ExecJob
addFessConfigProperties, addFessCustomSystemProperties, addFessSystemProperties, addSystemProperty, appendJarFile, createSystemProperties, createTimeoutTask, deleteTempDir, execute, gcLogging, getLogName, jobExecutor, jvmOptions, lastaEnv, logFilePath, logLevel, logSuffix, remoteDebug, sessionId, timeout, useLocalFesen
-
Field Details
-
namespace
The namespace identifier for the crawling session. Used to organize and identify crawling activities in the system. Defaults to the system crawling info name. -
webConfigIds
Array of web crawling configuration IDs to process. If null, all available web configurations will be crawled (when no other config IDs are specified). -
fileConfigIds
Array of file system crawling configuration IDs to process. If null, all available file configurations will be crawled (when no other config IDs are specified). -
dataConfigIds
Array of data source crawling configuration IDs to process. If null, all available data configurations will be crawled (when no other config IDs are specified). -
documentExpires
protected int documentExpiresDocument expiration setting in days. -2: use system default, -1: never expire, 0 or positive: expire after specified days. -
hotThreadInterval
protected int hotThreadIntervalHot thread monitoring interval in seconds. -1: disabled, positive value: enable hot thread monitoring with specified interval. Used for performance analysis and debugging of the crawler process.
-
-
Constructor Details
-
CrawlJob
public CrawlJob()Default constructor for CrawlJob. Initializes the job with default settings.
-
-
Method Details
-
namespace
Sets the namespace for the crawling session. The namespace is used to organize and identify crawling activities.- Parameters:
namespace- the namespace identifier for the crawling session- Returns:
- this CrawlJob instance for method chaining
-
documentExpires
Sets the document expiration period in days. Controls how long crawled documents remain in the search index.- Parameters:
documentExpires- the expiration period: -2 (system default), -1 (never expire), 0 or positive (expire after specified days)- Returns:
- this CrawlJob instance for method chaining
-
webConfigIds
Sets the web crawling configuration IDs to process. If not set, all available web configurations will be crawled.- Parameters:
webConfigIds- array of web crawling configuration IDs, or null for all- Returns:
- this CrawlJob instance for method chaining
-
fileConfigIds
Sets the file system crawling configuration IDs to process. If not set, all available file configurations will be crawled.- Parameters:
fileConfigIds- array of file crawling configuration IDs, or null for all- Returns:
- this CrawlJob instance for method chaining
-
dataConfigIds
Sets the data source crawling configuration IDs to process. If not set, all available data configurations will be crawled.- Parameters:
dataConfigIds- array of data crawling configuration IDs, or null for all- Returns:
- this CrawlJob instance for method chaining
-
hotThread
Sets the hot thread monitoring interval for performance analysis. Hot threads help identify performance bottlenecks in the crawler process.- Parameters:
hotThreadInterval- monitoring interval in seconds, -1 to disable- Returns:
- this CrawlJob instance for method chaining
-
execute
Description copied from class:ExecJobExecutes the job and returns the result as a string. This method contains the main business logic for the specific job implementation. -
getRunningJobCount
protected int getRunningJobCount()Gets the count of currently running crawler jobs. This method queries the scheduled jobs to count active crawler processes. Used to enforce maximum concurrent crawler limits.- Returns:
- the number of currently running crawler jobs
-
executeCrawler
protected void executeCrawler()Executes the crawler process in a separate JVM. This method constructs the command line arguments, sets up the classpath, and launches the crawler as an external process. It handles process lifecycle, monitors output, and ensures proper cleanup.- Throws:
JobProcessingException- if the crawler process fails or times out
-
getExecuteType
Description copied from class:ExecJobReturns the execution type identifier for this job. This type is used for classpath construction, configuration, and logging purposes.- Specified by:
getExecuteTypein classExecJob- Returns:
- the execution type (e.g., "crawler", "suggest", etc.)
-