Sorry, but I think I have not explained:
Currently only when we enable a schedule we add a job to scheduler(application scheduler- quartz ). Performing the following checks:
if ( isScheduleFromBuildJob( schedule ) )
// A buildDefinition with this schedule
schedule( schedule, continuum, ContinuumBuildJob.class );
if ( isScheduleFromPurgeJob( schedule ) )
// A purge with this schedule
schedule( schedule, continuum, ContinuumPurgeJob.class );
That way if the schedule is not linked to a buildDefinition or purgeConfiguration not work for them. After set a schedule for a buildDefinition/purgeConfiguration we need to update the schedule to add job(s) to application scheduler.
In this way, my options are:
1 - Always add the job (buildDefinition and purgeConfiguration) to the scheduler. Simpler and does not modify the code to buildDefinition and purgeConfiguration
2 - When a store purgeConfiguration / buildDefinition set a schedule we add job to application scheduler. More efficient (the scheduler only contains the jobs to be executed)
3 - Add a single job for application scheduler and its execution launch a thread for builds and other for purge. This solution is similar to the first.