Package org.quartzplus.service
Class InMemoryJobExecutionLogServiceImpl
java.lang.Object
org.quartzplus.service.InMemoryJobExecutionLogServiceImpl
- All Implemented Interfaces:
JobExecutionLogService
In-memory implementation of the
JobExecutionLogService that uses a circular buffer to store logs.
This implementation is ideal for development environments or lightweight applications where persistent
history is not required. It utilizes a thread-safe CircularFifoQueue to automatically
evict the oldest log entries once the maximum size is reached.
Note: Clustering support (getQuartzExecutionNodeList()) and database table prefixes
are not supported by this volatile implementation.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryJobExecutionLogServiceImpl(int maxSize) Constructs a new service instance with a fixed maximum buffer size. -
Method Summary
Modifier and TypeMethodDescriptionintclearJobExecutionLog(Instant since) Removes log entries from the buffer that were created before the specified timestamp.getJobExecutionLog(String jobExecutionLogId) Searches the in-memory queue for a log entry with the specified unique ID.org.springframework.data.domain.Page<JobExecutionLog> getJobExecutionLogList(Integer pageSize, Integer currentPage, String groupName, String jobName, String triggerName, String instanceClass) Filters and retrieves a paged list of logs from memory.This implementation does not track cluster nodes.This implementation does not use database tables.voidinsertJobExecutionLog(JobExecutionLog jobExecutionLog) Adds a new log entry to the buffer.
-
Constructor Details
-
InMemoryJobExecutionLogServiceImpl
public InMemoryJobExecutionLogServiceImpl(int maxSize) Constructs a new service instance with a fixed maximum buffer size.- Parameters:
maxSize- the maximum number ofJobExecutionLogentries to retain.
-
-
Method Details
-
getJobExecutionLogList
public org.springframework.data.domain.Page<JobExecutionLog> getJobExecutionLogList(Integer pageSize, Integer currentPage, @Nullable String groupName, @Nullable String jobName, @Nullable String triggerName, @Nullable String instanceClass) Filters and retrieves a paged list of logs from memory.Filtering is performed via stream predicates. If a filter parameter is blank or null, it is ignored during the search.
- Specified by:
getJobExecutionLogListin interfaceJobExecutionLogService- Parameters:
pageSize- the number of logs per page.currentPage- the current page index (zero-based).groupName- (Optional) filter by job group.jobName- (Optional) filter by job name.triggerName- (Optional) filter by trigger name.instanceClass- (Optional) filter by the job class name.- Returns:
- a
Pagecontaining the filtered logs.
-
getJobExecutionLog
Searches the in-memory queue for a log entry with the specified unique ID.- Specified by:
getJobExecutionLogin interfaceJobExecutionLogService- Parameters:
jobExecutionLogId- the UUID of the log entry.- Returns:
- an
Optionalcontaining the log if found.
-
insertJobExecutionLog
Adds a new log entry to the buffer. If the buffer is full, the oldest entry is automatically evicted.- Specified by:
insertJobExecutionLogin interfaceJobExecutionLogService- Parameters:
jobExecutionLog- the log entry to store.
-
clearJobExecutionLog
Removes log entries from the buffer that were created before the specified timestamp.- Specified by:
clearJobExecutionLogin interfaceJobExecutionLogService- Parameters:
since- the cutoff timestamp for removal.- Returns:
- the total number of entries removed from memory.
-
getQuartzExecutionNodeList
This implementation does not track cluster nodes.- Specified by:
getQuartzExecutionNodeListin interfaceJobExecutionLogService- Returns:
- an empty list.
-
getTablePrefix
This implementation does not use database tables.- Specified by:
getTablePrefixin interfaceJobExecutionLogService- Returns:
- an empty string.
-