Class CancelPeriodic

All Implemented Interfaces:
Serializable

public class CancelPeriodic extends RuntimeException
Exception used to cancel a periodic schedule from a schedule handler.

When thrown from a HandleSchedule handler that was triggered by a MessageScheduler.schedulePeriodic(Object) invocation, this exception will signal to the scheduler that the associated periodic schedule should be cancelled permanently.

Unlike other exceptions thrown during schedule handling, this will not result in a log warning or error. It is a controlled mechanism for terminating a repeating schedule.

Example usage:


@HandleSchedule
void handle(MyPeriodicMessage message) {
    if (shouldStop(message)) {
        throw new CancelPeriodic();
    }
    // process message
}

See Also:
  • Constructor Details

    • CancelPeriodic

      public CancelPeriodic()