Class TaskSchedulingAction
java.lang.Object
eu.cloudnetservice.driver.impl.network.scheduler.TaskSchedulingAction
- All Implemented Interfaces:
Runnable
The task scheduler runnable that is responsible for scheduling incoming tasks into the target executor service. Due
to the fact that the scheduling action could be blocking, this action should be scheduled in a separate thread.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ThreadPoolExecutorprivate final LinkedBlockingQueue<Runnable> -
Constructor Summary
ConstructorsConstructorDescriptionTaskSchedulingAction(@NonNull ThreadPoolExecutor targetExecutor, @NonNull LinkedBlockingQueue<Runnable> unscheduledTaskQueue) Constructs a new task scheduling action. -
Method Summary
Modifier and TypeMethodDescriptionvoidrun()Schedules tasks that were added to the unscheduled tasks queue into the target executor.voidscheduleTask(@NonNull Runnable task) Schedules the given task for execution.
-
Field Details
-
targetExecutor
-
unscheduledTasks
-
-
Constructor Details
-
TaskSchedulingAction
public TaskSchedulingAction(@NonNull @NonNull ThreadPoolExecutor targetExecutor, @NonNull @NonNull LinkedBlockingQueue<Runnable> unscheduledTaskQueue) Constructs a new task scheduling action.- Parameters:
targetExecutor- the executor to execute unscheduled tasks.unscheduledTaskQueue- the queue for unscheduled tasks.- Throws:
NullPointerException- if the given target executor or unscheduled task queue is null.
-
-
Method Details
-
run
-
scheduleTask
Schedules the given task for execution.- Parameters:
task- the task to execute.- Throws:
NullPointerException- if the given task is null.
-