Class TaskUtils


  • public final class TaskUtils
    extends java.lang.Object
    A helper class with utilities to act upon Runnable and/or Callable tasks.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Runnable autoDisposable​(java.lang.Runnable runnable)
      Decorate any Runnable with a AutoDisposableTask to destroy automatically after execution
      static <V> java.util.concurrent.Callable<V> autoDisposable​(java.util.concurrent.Callable<V> callable)
      Decorate any Callable with a AutoDisposableTask to destroy automatically after execution
      static java.lang.Runnable named​(java.lang.String name, java.lang.Runnable runnable)
      Decorate any Runnable with a NamedTask to provide naming information to scheduler.
      static <V> java.util.concurrent.Callable<V> named​(java.lang.String name, java.util.concurrent.Callable<V> callable)
      Decorate any Callable with a NamedTask to provide naming information to scheduler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • named

        public static java.lang.Runnable named​(java.lang.String name,
                                               java.lang.Runnable runnable)
        Decorate any Runnable with a NamedTask to provide naming information to scheduler.
        Parameters:
        name - The name that the task will have
        runnable - The runnable task to be named
        Returns:
        A new Runnable implementing the NamedTask interface
      • named

        public static <V> java.util.concurrent.Callable<V> named​(java.lang.String name,
                                                                 java.util.concurrent.Callable<V> callable)
        Decorate any Callable with a NamedTask to provide naming information to scheduler.
        Type Parameters:
        V - The return type of callable task
        Parameters:
        name - The name that the task will have
        callable - The callable task to be named
        Returns:
        A new Callable implementing the NamedTask interface
      • autoDisposable

        public static java.lang.Runnable autoDisposable​(java.lang.Runnable runnable)
        Decorate any Runnable with a AutoDisposableTask to destroy automatically after execution
        Parameters:
        runnable - The runnable task to be disposed automatically
        Returns:
        A new Runnable implementing the AutoDisposableTask interface
      • autoDisposable

        public static <V> java.util.concurrent.Callable<V> autoDisposable​(java.util.concurrent.Callable<V> callable)
        Decorate any Callable with a AutoDisposableTask to destroy automatically after execution
        Type Parameters:
        V - The return type of callable task
        Parameters:
        callable - The callable task to be disposed automatically
        Returns:
        A new Callable implementing the AutoDisposableTask interface