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
}
}