Annotation Interface OnUnscheduled


@Documented @Target(METHOD) @Retention(RUNTIME) @Inherited public @interface OnUnscheduled

Marker annotation a Processor or ReportingTask should be called whenever the component is no longer scheduled to run. Methods marked with this annotation will be invoked each time the framework is notified to stop scheduling the component. This method is invoked as other threads are potentially running. To invoke a method after all threads have finished processing, see the OnStopped annotation.

Methods using this annotation must take either 0 arguments or a single argument.

If using 1 argument and the component using the annotation is a Processor, that argument must be of type ProcessContext.

If using 1 argument and the component using the annotation is a Reporting Task, that argument must be of type ConfigurationContext.

Implementation Guidelines:

  • Methods with this annotation are expected to perform very quick, short-lived tasks. If the function is expensive or long-lived, the logic should be performed in the onTrigger method instead.
  • If a method with this annotation does not return (exceptionally or otherwise) within a short period of time (the duration is configurable in the properties file), the Thread may be interrupted.
  • Methods that make use of this interface should honor Java's Thread interruption mechanisms and not swallow InterruptedException.