Class TaskManager
java.lang.Object
io.goobi.viewer.api.rest.model.tasks.TaskManager
Manages (possibly timeconsuming)
tasks within the viewer which can be triggered and monitored via the TasksResource. The tasks
are not executed sequentially or queued in any way, except through the limit of the internal thread pool (5 parallel tasks)- Author:
- Florian Alpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BiConsumer<HttpServletRequest, Task> createTask(TaskType type) getTask(long jobId) getTasks()booleanremoveTask(long jobId) voidshutdown()Shuts down the internal thread pool.triggerTaskInThread(long jobId, HttpServletRequest request)
-
Constructor Details
-
TaskManager
Creates new JobManager.- Parameters:
jobLiveTime- The guaranteed live time of jobs in the jobManager
-
-
Method Details
-
addTask
-
getTask
-
removeTask
-
triggerTaskInThread
-
getTasks
-
getTasks
-
shutdown
public void shutdown()Shuts down the internal thread pool. Attempts to stop running tasks; waits up to 5 seconds for threads to terminate. Should be called from the servlet context listener on undeploy. -
isShutdown
public boolean isShutdown()- Returns:
- true if the internal executor service has been shut down
-
createTask
- Parameters:
type- task type for which to create the handler- Returns:
- BiConsumer<HttpServletRequest, Task>
-