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 TaskPiece of code that that has no result and may throw an exception. Similar toRunnableorCallable.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Taskof(java.lang.Runnable runnable)Creates a Task from Runnable.static Taskof(java.util.concurrent.Callable callable)Creates a Task from Callable.voidrun()Runs a code or throws an exception if unable to do so.default java.util.concurrent.CallabletoCallable()Wraps a task into a callable that returnsnull.default java.lang.RunnabletoRunnable()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 returnsnull.
-
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
-
-