Class TaskUtils

java.lang.Object
com.hazelcast.scheduledexecutor.TaskUtils

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

    • named

      public static Runnable named(String name, 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> Callable<V> named(String name, 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 Runnable autoDisposable(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> Callable<V> autoDisposable(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