-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Form a simple discovery test, I've created a Job managed programmatically because I aim at having a console to drive execution batchs by users.
Then in main:
// Manage my job programmatically
SundialJobScheduler.addJob( HelloJob.jobName(), HelloJob.class.getName());
// Run my job every 2 seconds and unlimitedly
SundialJobScheduler.addSimpleTrigger(
HelloJob.jobName() + "-Trigger", HelloJob.jobName(), -1, TimeUnit.SECONDS.toMillis(2));
In HelloJob.java:
@Override
public void doRun() throws JobInterruptException {
System.out.println( String.format( "Hello Job %d at [%s]", ++count, DF.format( new Date())));
if ( count >= 3 ) {
System.out.println( "interrupted by itself");
//SundialJobScheduler.removeTrigger( jobName() + "-Trigger");
//SundialJobScheduler.stopJob( jobName()); // ineffective call
throw new JobInterruptException(); // ineffective
}
}
Throwing JobInterruptException was hoping to trigger some behavior at monitor level, but nothing happened. Just wonder the utility of this exception then...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels