How to stop sling scheduler work if inconsistent situation occures inside the job?

1k views Asked by At

I have the following field:

@Reference
private Scheduler scheduler;

Scheduler from package org.apache.sling.commons.scheduler

And I have Runnable job field:

protected Runnable job;

I run scheduling:

scheduler.schedule(this.job, this.scheduleOptions);

I want to stop scheduling if inside the job occurs something wrong

public void run() {
       if(checkThatSomethingWrong()){
            //stop job
       }
}
0

There are 0 answers