Skip to content

Ineffective JobInterruptException #46

@franckvallee

Description

@franckvallee

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions