Class CustomTaskFailedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.i2group.disco.task.spi.CustomTaskFailedException
All Implemented Interfaces:
Serializable

public class CustomTaskFailedException extends RuntimeException
An exception to throw when some aspect of a scheduled custom task fails. The contents of the exception tell the server whether to execute the task again (immediately, or on its normal schedule), or to cancel the task and not attempt to execute it again.
Since:
12.0
See Also:
  • Method Details

    • retry

      public static CustomTaskFailedException retry(String message)
      Creates a CustomTaskFailedException that tells the server to retry the task immediately.
      Parameters:
      message - The exception message.
      Returns:
      See above.
    • reschedule

      public static CustomTaskFailedException reschedule(String message)
      Creates a CustomTaskFailedException that tells the server to reschedule the task normally.
      Parameters:
      message - The exception message.
      Returns:
      See above.
    • cancel

      public static CustomTaskFailedException cancel(String message)
      Creates a CustomTaskFailedException that tells the server not to run the task again.
      Parameters:
      message - The exception message.
      Returns:
      See above.
    • shouldRetry

      public boolean shouldRetry()
      Indicates whether the server should retry the task that threw the exception.
      Returns:
      true if the server should retry the task; false otherwise.
    • shouldReschedule

      public boolean shouldReschedule()
      Indicates whether the server should reschedule the task that threw the exception.
      Returns:
      true if the server should reschedule the task; false otherwise.
    • shouldCancel

      public boolean shouldCancel()
      Indicates whether the server should cancel the task that threw the exception.
      Returns:
      true if the server should cancel the task; false otherwise.