Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ineffective JobInterruptException #46

Open
franckvallee opened this issue Apr 21, 2019 · 0 comments
Open

Ineffective JobInterruptException #46

franckvallee opened this issue Apr 21, 2019 · 0 comments

Comments

@franckvallee
Copy link

franckvallee commented Apr 21, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant