Package me.hsgamer.hscore.task
Class BatchRunnable
java.lang.Object
me.hsgamer.hscore.task.BatchRunnable
- All Implemented Interfaces:
Runnable
A runnable that runs a batch of tasks in sequence
-
Constructor Summary
ConstructorDescriptionCreate a new batch runnable with the default data storageBatchRunnable
(TaskData data) Create a new batch runnable -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTaskPool
(int stage, Consumer<TaskPool> taskPoolConsumer) Execute the consumer for the task poolgetData()
Get the datagetTaskPool
(int stage) Get the task poolboolean
Check if the task is interrupted by the timeoutvoid
run()
void
setTimeout
(long timeout, TimeUnit unit) Set the timeout for each task
-
Constructor Details
-
BatchRunnable
Create a new batch runnable- Parameters:
data
- the data
-
BatchRunnable
public BatchRunnable()Create a new batch runnable with the default data storage- See Also:
-
-
Method Details
-
run
public void run() -
getTaskPool
Get the task pool- Parameters:
stage
- the stage of the task pool- Returns:
- the task pool
-
addTaskPool
Execute the consumer for the task pool- Parameters:
stage
- the stage of the task pooltaskPoolConsumer
- the consumer
-
setTimeout
Set the timeout for each task- Parameters:
timeout
- the timeoutunit
- the unit of the timeout
-
isTimeout
public boolean isTimeout()Check if the task is interrupted by the timeout- Returns:
- true if it is
-
getData
Get the data- Returns:
- the data
-