Package org.codelibs.fess.app.service
Class JobLogService
java.lang.Object
org.codelibs.fess.app.service.JobLogService
Service class for managing job logs in the Fess application.
Provides functionality to create, read, update, and delete job log entries,
as well as manage job status and perform cleanup operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longTime interval in milliseconds after which jobs are considered expired.protected org.codelibs.fess.mylasta.direction.FessConfigConfiguration settings for the Fess application.protected org.codelibs.fess.opensearch.config.exbhv.JobLogBhvBehavior class for job log database operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Deletes a specific job log from the database.voiddeleteBefore(int days) Deletes job logs that ended before the specified number of days ago.voiddeleteByJobStatus(List<String> jobStatusList) Deletes job logs that have any of the specified job statuses.org.dbflute.optional.OptionalEntity<org.codelibs.fess.opensearch.config.exentity.JobLog> Retrieves a specific job log by its ID.List<org.codelibs.fess.opensearch.config.exentity.JobLog> getJobLogList(JobLogPager jobLogPager) Retrieves a paginated list of job logs based on the provided pager configuration.voidsetExpiredJobInterval(long expiredJobInterval) Sets the time interval after which jobs are considered expired.protected voidsetupListCondition(org.codelibs.fess.opensearch.config.cbean.JobLogCB cb, JobLogPager jobLogPager) Sets up the query conditions for retrieving job logs based on the pager configuration.voidstore(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Stores a job log entry in the database.voidUpdates the status of expired jobs that haven't finished.
-
Field Details
-
jobLogBhv
protected org.codelibs.fess.opensearch.config.exbhv.JobLogBhv jobLogBhvBehavior class for job log database operations. -
fessConfig
protected org.codelibs.fess.mylasta.direction.FessConfig fessConfigConfiguration settings for the Fess application. -
expiredJobInterval
protected long expiredJobIntervalTime interval in milliseconds after which jobs are considered expired. Default is 2 hours (2 * 60 * 60 * 1000L).
-
-
Constructor Details
-
JobLogService
public JobLogService()Default constructor.
-
-
Method Details
-
getJobLogList
public List<org.codelibs.fess.opensearch.config.exentity.JobLog> getJobLogList(JobLogPager jobLogPager) Retrieves a paginated list of job logs based on the provided pager configuration.- Parameters:
jobLogPager- the pager configuration for pagination and filtering- Returns:
- a list of job logs matching the criteria
-
getJobLog
public org.dbflute.optional.OptionalEntity<org.codelibs.fess.opensearch.config.exentity.JobLog> getJobLog(String id) Retrieves a specific job log by its ID.- Parameters:
id- the unique identifier of the job log- Returns:
- an optional entity containing the job log if found
-
store
public void store(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Stores a job log entry in the database. Performs an insert or update operation based on whether the job log already exists.- Parameters:
jobLog- the job log to store
-
delete
public void delete(org.codelibs.fess.opensearch.config.exentity.JobLog jobLog) Deletes a specific job log from the database.- Parameters:
jobLog- the job log to delete
-
setupListCondition
protected void setupListCondition(org.codelibs.fess.opensearch.config.cbean.JobLogCB cb, JobLogPager jobLogPager) Sets up the query conditions for retrieving job logs based on the pager configuration. Configures filtering and ordering for the database query.- Parameters:
cb- the condition bean for building the queryjobLogPager- the pager containing filter and search criteria
-
deleteBefore
public void deleteBefore(int days) Deletes job logs that ended before the specified number of days ago. Used for cleaning up old log entries.- Parameters:
days- the number of days to look back from the current time
-
deleteByJobStatus
Deletes job logs that have any of the specified job statuses.- Parameters:
jobStatusList- the list of job statuses to match for deletion
-
updateStatus
public void updateStatus()Updates the status of expired jobs that haven't finished. Jobs that have been running longer than the expired job interval without an end time are marked as failed. -
setExpiredJobInterval
public void setExpiredJobInterval(long expiredJobInterval) Sets the time interval after which jobs are considered expired.- Parameters:
expiredJobInterval- the time interval in milliseconds
-