Package jodd.util

Interface Task

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Task
    Piece of code that that has no result and may throw an exception. Similar to Runnable or Callable.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static Task of​(java.lang.Runnable runnable)
      Creates a Task from Runnable.
      static Task of​(java.util.concurrent.Callable callable)
      Creates a Task from Callable.
      void run()
      Runs a code or throws an exception if unable to do so.
      default java.util.concurrent.Callable toCallable()
      Wraps a task into a callable that returns null.
      default java.lang.Runnable toRunnable()
      Wraps a task into a runnable.
    • Method Detail

      • of

        static Task of​(java.lang.Runnable runnable)
        Creates a Task from Runnable.
      • of

        static Task of​(java.util.concurrent.Callable callable)
        Creates a Task from Callable.
      • toRunnable

        default java.lang.Runnable toRunnable()
        Wraps a task into a runnable.
      • toCallable

        default java.util.concurrent.Callable toCallable()
        Wraps a task into a callable that returns null.
      • run

        void run()
          throws java.lang.Exception
        Runs a code or throws an exception if unable to do so.
        Throws:
        java.lang.Exception - if unable to execute task