@FieldsAreNonnullByDefault @ParametersAreNonnullByDefault @ReturnValuesAreNonnullByDefault public class DefaultLongRunningTaskManager extends Object implements LongRunningTaskManagerInternal, org.springframework.beans.factory.DisposableBean
Constructor and Description |
---|
DefaultLongRunningTaskManager(PermissionManager permissionManager,
ActivityMonitor activityMonitor,
LongRunningTaskMonitor longRunningTaskMonitor) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
PageResponse<LongTaskStatus> |
getAllTasks(@Nullable ConfluenceUser asUser,
LimitedRequest request)
Get all currently-tracked tasks that the specified user can see.
|
@Nullable com.atlassian.core.task.longrunning.LongRunningTask |
getLongRunningTask(@Nullable com.atlassian.user.User user,
LongRunningTaskId taskId)
gets a long running task with the given Id that was registered either by this user
or the anonymous user.
|
LongRunningTaskId |
queueLongRunningTask(com.atlassian.core.task.longrunning.LongRunningTask task)
Start tracking a long running task that should be started in a new thread when
LongRunningTaskManagerInternal.startIfQueued(com.atlassian.confluence.util.longrunning.LongRunningTaskId)
is called. |
List<LongTaskStatus> |
removeComplete()
Remove completed tasks from the tracker.
|
void |
resume()
Resume accepting long-running tasks after
LongRunningTaskManager.stop(long, java.util.concurrent.TimeUnit) has been called. |
void |
startIfQueued(LongRunningTaskId taskId)
Starts the task in a new thread if it has previously been queued.
|
LongRunningTaskId |
startLongRunningTask(@Nullable com.atlassian.user.User user,
com.atlassian.core.task.longrunning.LongRunningTask task)
Start some task in a new thread
|
void |
stop(long timeout,
TimeUnit unit)
Stop accepting new long running tasks.
|
void |
stopTrackingLongRunningTask(LongRunningTaskId taskId)
Clean up an old task.
|
protected void |
taskFinished(LongRunningTaskId taskId) |
public DefaultLongRunningTaskManager(PermissionManager permissionManager, ActivityMonitor activityMonitor, LongRunningTaskMonitor longRunningTaskMonitor)
public LongRunningTaskId queueLongRunningTask(com.atlassian.core.task.longrunning.LongRunningTask task)
LongRunningTaskManagerInternal
LongRunningTaskManagerInternal.startIfQueued(com.atlassian.confluence.util.longrunning.LongRunningTaskId)
is called.queueLongRunningTask
in interface LongRunningTaskManagerInternal
task
- the task to performpublic void startIfQueued(LongRunningTaskId taskId)
LongRunningTaskManagerInternal
startIfQueued
in interface LongRunningTaskManagerInternal
taskId
- the ID of the taskpublic LongRunningTaskId startLongRunningTask(@Nullable com.atlassian.user.User user, com.atlassian.core.task.longrunning.LongRunningTask task)
LongRunningTaskManager
startLongRunningTask
in interface LongRunningTaskManager
user
- the user responsible for the tasktask
- the task to performpublic @Nullable com.atlassian.core.task.longrunning.LongRunningTask getLongRunningTask(@Nullable com.atlassian.user.User user, LongRunningTaskId taskId)
getLongRunningTask
in interface LongRunningTaskManager
user
- the user responsible for the tasktaskId
- the ID of the taskpublic PageResponse<LongTaskStatus> getAllTasks(@Nullable ConfluenceUser asUser, LimitedRequest request)
LongRunningTaskManagerInternal
getAllTasks
in interface LongRunningTaskManagerInternal
public List<LongTaskStatus> removeComplete()
LongRunningTaskManagerInternal
removeComplete
in interface LongRunningTaskManagerInternal
public void stopTrackingLongRunningTask(LongRunningTaskId taskId)
LongRunningTaskManager
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.
stopTrackingLongRunningTask
in interface LongRunningTaskManager
taskId
- the ID of the task to remove.public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public void stop(long timeout, TimeUnit unit) throws TimeoutException
LongRunningTaskManager
stop
in interface LongRunningTaskManager
timeout
- the time to wait for running tasks to completeunit
- the unit of measurement for the timeout parameterTimeoutException
- if the timeout is exceededpublic void resume()
LongRunningTaskManager
LongRunningTaskManager.stop(long, java.util.concurrent.TimeUnit)
has been called. If
the long-running task manager is not stopped, this method will whistle
quietly to itself and do nothing.resume
in interface LongRunningTaskManager
protected void taskFinished(LongRunningTaskId taskId)
Copyright © 2003–2020 Atlassian. All rights reserved.