Package org.omegazero.common.event.task
Class LambdaTask
java.lang.Object
org.omegazero.common.event.task.AbstractTask
org.omegazero.common.event.task.LambdaTask
- All Implemented Interfaces:
Comparable<Task>
,Runnable
,Task
- Direct Known Subclasses:
TaskScheduler.TimerTask
- Since:
- 2.6
-
Constructor Summary
ConstructorsConstructorDescriptionLambdaTask
(Consumer<Object[]> handler, Object[] args) Creates a newLambdaTask
.LambdaTask
(Consumer<Object[]> handler, Object[] args, int priority) Creates a newLambdaTask
. -
Method Summary
Methods inherited from class org.omegazero.common.event.task.AbstractTask
getPriority, run
-
Constructor Details
-
LambdaTask
Creates a newLambdaTask
.- Parameters:
handler
- The task handlerargs
- The arguments to pass to the task handler when this task is executed- See Also:
-
LambdaTask
Creates a newLambdaTask
.- Parameters:
handler
- The task handlerargs
- The arguments to pass to the task handler when this task is executedpriority
- The priority of this task- See Also:
-
-
Method Details
-
destroy
public void destroy()Removes the reference to the handler passed in the constructor.- Since:
- 2.9.2
-
execute
Description copied from class:AbstractTask
Executes this task with the given arguments.- Specified by:
execute
in classAbstractTask
- Parameters:
args
- The arguments to pass to the task handler- Throws:
Exception
- If an error occurs
-