Package org.codelibs.fess.helper
Class JobHelper
java.lang.Object
org.codelibs.fess.helper.JobHelper
Helper class for managing scheduled jobs within the Fess system.
This class provides functionality for registering, unregistering, and monitoring scheduled jobs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ThreadLocal<org.lastaflute.job.LaJobRuntime> Thread-local storage for job runtime informationprotected intMonitor interval in seconds (default: 1 hour) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.lastaflute.job.LaJobRuntimeGets the job runtime for the current thread.booleanisAvailable(String id) Checks if a job with the specified ID is available.voidregister(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Registers a scheduled job with the job manager.voidregister(org.lastaflute.job.LaCron cron, org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Registers a scheduled job with the specified cron scheduler.voidremove(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Removes a scheduled job completely from the job manager.voidsetJobRuntime(org.lastaflute.job.LaJobRuntime runtime) Sets the job runtime for the current thread.voidsetMonitorInterval(int monitorInterval) Sets the monitor interval for job monitoring.org.codelibs.core.timer.TimeoutTaskstartMonitorTask(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Starts a monitor task for tracking job execution.voidstore(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Stores a job log entry in the database.voidunregister(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Unregisters a scheduled job from the job manager.
-
Field Details
-
monitorInterval
protected int monitorIntervalMonitor interval in seconds (default: 1 hour) -
jobRuntimeLocal
Thread-local storage for job runtime information
-
-
Constructor Details
-
JobHelper
public JobHelper()Default constructor.
-
-
Method Details
-
register
public void register(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Registers a scheduled job with the job manager.- Parameters:
scheduledJob- the scheduled job to register
-
register
public void register(org.lastaflute.job.LaCron cron, org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Registers a scheduled job with the specified cron scheduler.- Parameters:
cron- the cron scheduler to usescheduledJob- the scheduled job to register
-
unregister
public void unregister(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Unregisters a scheduled job from the job manager.- Parameters:
scheduledJob- the scheduled job to unregister- Throws:
ScheduledJobException- if the job cannot be unregistered
-
remove
public void remove(org.codelibs.fess.opensearch.config.exentity.ScheduledJob scheduledJob) Removes a scheduled job completely from the job manager.- Parameters:
scheduledJob- the scheduled job to remove- Throws:
ScheduledJobException- if the job cannot be removed
-
isAvailable
Checks if a job with the specified ID is available.- Parameters:
id- the job ID to check- Returns:
- true if the job is available, false otherwise
-
store
public void store(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Stores a job log entry in the database.- Parameters:
jobLog- the job log entry to store
-
startMonitorTask
public org.codelibs.core.timer.TimeoutTask startMonitorTask(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Starts a monitor task for tracking job execution.- Parameters:
jobLog- the job log to monitor- Returns:
- the timeout task for monitoring
-
setMonitorInterval
public void setMonitorInterval(int monitorInterval) Sets the monitor interval for job monitoring.- Parameters:
monitorInterval- the monitor interval in seconds
-
setJobRuntime
public void setJobRuntime(org.lastaflute.job.LaJobRuntime runtime) Sets the job runtime for the current thread.- Parameters:
runtime- the job runtime to set
-
getJobRuntime
public org.lastaflute.job.LaJobRuntime getJobRuntime()Gets the job runtime for the current thread.- Returns:
- the job runtime for the current thread
-