Package com.hazelcast.scheduledexecutor
Class TaskUtils
- java.lang.Object
-
- com.hazelcast.scheduledexecutor.TaskUtils
-
public final class TaskUtils extends java.lang.Object
A helper class with utilities to act uponRunnable
and/orCallable
tasks.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Runnable
autoDisposable(java.lang.Runnable runnable)
Decorate anyRunnable
with aAutoDisposableTask
to destroy automatically after executionstatic <V> java.util.concurrent.Callable<V>
autoDisposable(java.util.concurrent.Callable<V> callable)
Decorate anyCallable
with aAutoDisposableTask
to destroy automatically after executionstatic java.lang.Runnable
named(java.lang.String name, java.lang.Runnable runnable)
Decorate anyRunnable
with aNamedTask
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 anyCallable
with aNamedTask
to provide naming information to scheduler.
-
-
-
Method Detail
-
named
public static java.lang.Runnable named(java.lang.String name, java.lang.Runnable runnable)
Decorate anyRunnable
with aNamedTask
to provide naming information to scheduler.- Parameters:
name
- The name that the task will haverunnable
- 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 anyCallable
with aNamedTask
to provide naming information to scheduler.- Type Parameters:
V
- The return type of callable task- Parameters:
name
- The name that the task will havecallable
- 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 anyRunnable
with aAutoDisposableTask
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 anyCallable
with aAutoDisposableTask
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
-
-