Class TaskQueue
java.lang.Object
io.jenkins.tools.pluginmodernizer.tui.task.TaskQueue
- All Implemented Interfaces:
AutoCloseable
Run tasks one at a time, in queue order, on a single background thread.
Log lines are routed to the running task. One task runs at a time because the core services share one configuration and are not safe for concurrent plugin processing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanSkip a queued task, or ask a running task to stop.intRemove all finished tasksvoidclose()longcount(TaskStatus status) voidAppend a log line to the running task, or to the global logs when the queue is idlebooleanSwap a queued task with the previous or next queued taskbooleanRemove a queued or finished task from the listQueue a finished task again as a new task with the same name and workrunning()booleanSkip queued tasks, interrupt the running one and wait for it to stopAdd a task at the end of the queuetasks()
-
Constructor Details
-
TaskQueue
public TaskQueue()
-
-
Method Details
-
submit
-
restart
-
log
Append a log line to the running task, or to the global logs when the queue is idle- Parameters:
line- the formatted line
-
tasks
-
running
-
count
-
globalLogs
-
cancel
Skip a queued task, or ask a running task to stop. The core does not check interruptions, so a running task may keep working until its plugin is processed.- Parameters:
task- the task- Returns:
- false if the task is already done
-
remove
Remove a queued or finished task from the list- Parameters:
task- the task- Returns:
- false if the task is running
-
clearFinished
public int clearFinished()Remove all finished tasks- Returns:
- the number of removed tasks
-
move
Swap a queued task with the previous or next queued task- Parameters:
task- the queued taskdelta- negative to run it earlier, positive to run it later- Returns:
- true if the task moved
-
shutdown
Skip queued tasks, interrupt the running one and wait for it to stop- Parameters:
timeout- maximum time to wait- Returns:
- true if the worker stopped in time
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-