Interface LongRunningTaskManager
- All Known Subinterfaces:
LongRunningTaskManagerInternal
- All Known Implementing Classes:
DefaultLongRunningTaskManager
@ParametersAreNonnullByDefault
@ReturnValuesAreNonnullByDefault
public interface LongRunningTaskManager
Coordinates the creation and maintenance of batch jobs that last longer than a single web
request
-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable com.atlassian.core.task.longrunning.LongRunningTask
getLongRunningTask
(@Nullable ConfluenceUser user, LongRunningTaskId id) Retrieve a previously started task.@Nullable com.atlassian.core.task.longrunning.LongRunningTask
getLongRunningTask
(@Nullable com.atlassian.user.User user, LongRunningTaskId id) Deprecated, for removal: This API element is subject to removal in a future version.void
resume()
Resume accepting long-running tasks afterstop(java.time.Duration)
has been called.default LongRunningTaskId
startLongRunningTask
(@Nullable ConfluenceUser user, com.atlassian.core.task.longrunning.LongRunningTask task) Start some task in a new threadstartLongRunningTask
(@Nullable com.atlassian.user.User user, com.atlassian.core.task.longrunning.LongRunningTask task) Deprecated, for removal: This API element is subject to removal in a future version.since 9.5 usestartLongRunningTask(ConfluenceUser, LongRunningTask)
void
Deprecated, for removal: This API element is subject to removal in a future version.since 9.5 usestop(Duration)
default void
Stop accepting new long running tasks.void
Clean up an old task.
-
Method Details
-
startLongRunningTask
default LongRunningTaskId startLongRunningTask(@Nullable ConfluenceUser user, com.atlassian.core.task.longrunning.LongRunningTask task) Start some task in a new thread- Parameters:
user
- the user responsible for the tasktask
- the task to perform- Returns:
- an ID that can be used to look up the task
- Throws:
IllegalStateException
- if the task manager has been shut down- Since:
- 9.5
-
startLongRunningTask
@Deprecated(forRemoval=true, since="9.5") LongRunningTaskId startLongRunningTask(@Nullable com.atlassian.user.User user, com.atlassian.core.task.longrunning.LongRunningTask task) Deprecated, for removal: This API element is subject to removal in a future version.since 9.5 usestartLongRunningTask(ConfluenceUser, LongRunningTask)
Start some task in a new thread- Parameters:
user
- the user responsible for the tasktask
- the task to perform- Returns:
- an ID that can be used to look up the task
- Throws:
IllegalStateException
- if the task manager has been shut down
-
getLongRunningTask
default @Nullable com.atlassian.core.task.longrunning.LongRunningTask getLongRunningTask(@Nullable ConfluenceUser user, LongRunningTaskId id) Retrieve a previously started task. The task may be completed.- Parameters:
user
- the user responsible for the taskid
- the ID of the task- Returns:
- the task, or null if no task is registered with that ID and user
- Since:
- 9.5
-
getLongRunningTask
@Deprecated(forRemoval=true, since="9.5") @Nullable com.atlassian.core.task.longrunning.LongRunningTask getLongRunningTask(@Nullable com.atlassian.user.User user, LongRunningTaskId id) Deprecated, for removal: This API element is subject to removal in a future version.since 9.5 usegetLongRunningTask(ConfluenceUser, LongRunningTaskId)
Retrieve a previously started task. The task may be completed.- Parameters:
user
- the user responsible for the taskid
- the ID of the task- Returns:
- the task, or null if no task is registered with that ID and user
-
stopTrackingLongRunningTask
Clean up an old task. The manager hangs on to tasks that have been completed so their status can be queried. Calling this method will remove the task from the manager entirely.This method does not stop a task from being executed. If the task is already running it will continue to completion, you just won't be able to query its status any more.
- Parameters:
id
- the ID of the task to remove.
-
stop
Stop accepting new long running tasks. All tasks that have previously been submitted will be run to completion. If this takes longer than the timeout, the method will throw an exception and the task manager will resume normal operation accepting new tasks.- Parameters:
timeout
- the time to wait for running tasks to complete- Throws:
TimeoutException
- if the timeout is exceeded- Since:
- 9.5
-
stop
@Deprecated(forRemoval=true, since="9.5") void stop(long timeout, TimeUnit unit) throws TimeoutException Deprecated, for removal: This API element is subject to removal in a future version.since 9.5 usestop(Duration)
Stop accepting new long running tasks. All tasks that have previously been submitted will be run to completion. If this takes longer than the timeout, the method will throw an exception and the task manager will resume normal operation accepting new tasks.- Parameters:
timeout
- the time to wait for running tasks to completeunit
- the unit of measurement for the timeout parameter- Throws:
TimeoutException
- if the timeout is exceeded
-
resume
void resume()Resume accepting long-running tasks afterstop(java.time.Duration)
has been called. If the long-running task manager is not stopped, this method will whistle quietly to itself and do nothing.
-
getLongRunningTask(ConfluenceUser, LongRunningTaskId)