Class CancelAwareIterators

java.lang.Object
ch.tocco.nice2.tasks.api.quartz.CancelAwareIterators

public final class CancelAwareIterators extends Object
Iterators that can be used to handle cancellation in AbstractInterruptableJob
  • Method Details

    • stopOnCancel

      public static <A> Iterable<A> stopOnCancel(AbstractInterruptableJob job, Iterable<A> iterable)
      Return a new `Iterable` that delegates to the given one. On each next element, the `context` is checked whether the user cancelled the running action. If cancelled, the iterable changes to be exhausted.
    • stopOnCancel

      public static <A> Iterable<A> stopOnCancel(AbstractInterruptableJob job, A... elements)
      Return a new `Iterable` that delegates to the given one. On each next element, the `context` is checked whether the user cancelled the running action. If cancelled, the iterable changes to be exhausted.
    • errorOnCancel

      public static <A> Iterable<A> errorOnCancel(AbstractInterruptableJob job, Iterable<A> iterable)
      Return a new `Iterable` that delegates to the given one. On each next element access, the `context` is checked whether the user has cancelled the running action. If cancelled, the iterable throws an Exception.
    • errorOnCancel

      public static <A> Iterable<A> errorOnCancel(AbstractInterruptableJob job, A... elements)
      Return a new `Iterable` that delegates to the given one. On each next element access, the `context` is checked whether the user has cancelled the running action. If cancelled, the iterable throws an Exception.