Skip to content

Feature Request: Unified Method to Add Jobs in Scheduler #228

@jakmaz

Description

@jakmaz

Description:
The current implementation of the Scheduler class requires checking the type of each job (either SimpleIntervalJob or CronJob) to determine which add method to call. This design necessitates additional boilerplate code and type handling on the client's side.

    if (job instanceof IntervalJob) {
        this.scheduler.addIntervalJob(job);
    } else if (job instanceof CronJob) {
        this.scheduler.addCronJob(job);
    } else {
        throw new Error("Unsupported job type");
    }

Suggested Improvement:
I propose adding a unified method, addJob, to the Scheduler class to handle the addition of jobs regardless of their type. This method would internally check the job type and delegate to the appropriate existing method (addSimpleIntervalJob or addCronJob).

Benefits:
This change would simplify the Scheduler's usage by abstracting away the need for explicit type checks in client code, making the API cleaner and easier to use.

Request:
I would like to be assigned to this issue to implement the proposed feature, as I have already identified the necessary changes and am prepared to contribute the enhancement.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions