Details
Details
Assignee
Unassigned
UnassignedReporter
Michael Offner
Michael OffnerNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Priority
Created 23 April 2025 at 09:30
Updated 23 April 2025 at 09:30
Add support for StatefulJob implementation in the Quartz Scheduler integration to prevent jobs from overlapping when execution time exceeds the trigger interval.
Requirements
Add ability to configure jobs as stateful in job definition
Support both URL and Component jobs
Maintain backward compatibility with existing jobs
Document the new functionality
Proposed Implementation
Add stateful implementation options for both job types:
static.clazzCFCStateful = JavaCast("org.quartz.StatefulJob", new StatefulComponentJob()).getClass(); static.clazzURLStateful = JavaCast("org.quartz.StatefulJob", new StatefulURLJob()).getClass();
Modify the job creation logic to check for the stateful flag:
private function createJob(jobData) { var jobName = ""; var ignores = {}; var isStateful = jobData.stateful ?: false; // URL Job if(!isNull(jobData.url)) { // ...existing code... var builder = JobBuilder::newJob(isStateful ? static.clazzURLStateful : static.clazzURL) .withIdentity(jobData.id, "cfm") .usingJobData("url", jobData.url); } // Component Job else if(!isNull(jobData.component) || !isNull(jobData.cfc)) { // ...existing code... var builder = JobBuilder::newJob(isStateful ? static.clazzCFCStateful : static.clazzCFC) .withIdentity(jobData.id, "cfm") .usingJobData("component", jobData.component?:jobData.cfc); } // ...rest of existing code... }
Create implementations for StatefulComponentJob and StatefulURLJob classes
Configuration Example
{ "jobs": [ { "component": "path.to.MyLongRunningJob", "interval": 5, "stateful": true, "label": "Long Running Process" } ] }