@FieldsAreNonnullByDefault @ParametersAreNonnullByDefault @ReturnValuesAreNonnullByDefault public class DefaultLongRunningTaskManager extends Object implements LongRunningTaskManagerInternal, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
| Constructor and Description |
|---|
DefaultLongRunningTaskManager(PermissionManager permissionManager,
ActivityMonitor activityMonitor,
LongRunningTaskMonitor longRunningTaskMonitor,
com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
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.
|
int |
getTaskCount()
Return a count of the current queued and running tasks.
|
void |
onApplicationStopped(com.atlassian.config.lifecycle.events.ApplicationStoppedEvent e) |
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 |
runToCompletion(@Nullable com.atlassian.user.User user,
com.atlassian.core.task.longrunning.LongRunningTask task)
Starts a
LongRunningTask and waits for it to complete. |
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, com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar)
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanException@EventListener public void onApplicationStopped(com.atlassian.config.lifecycle.events.ApplicationStoppedEvent e)
public LongRunningTaskId queueLongRunningTask(com.atlassian.core.task.longrunning.LongRunningTask task)
LongRunningTaskManagerInternalLongRunningTaskManagerInternal.startIfQueued(com.atlassian.confluence.util.longrunning.LongRunningTaskId)
is called.queueLongRunningTask in interface LongRunningTaskManagerInternaltask - the task to performpublic void startIfQueued(LongRunningTaskId taskId)
LongRunningTaskManagerInternalstartIfQueued in interface LongRunningTaskManagerInternaltaskId - the ID of the taskpublic LongRunningTaskId startLongRunningTask(@Nullable com.atlassian.user.User user, com.atlassian.core.task.longrunning.LongRunningTask task)
LongRunningTaskManagerstartLongRunningTask in interface LongRunningTaskManageruser - the user responsible for the tasktask - the task to performpublic void runToCompletion(@Nullable com.atlassian.user.User user,
com.atlassian.core.task.longrunning.LongRunningTask task)
LongRunningTaskManagerInternalLongRunningTask and waits for it to complete.runToCompletion in interface LongRunningTaskManagerInternaluser - 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 LongRunningTaskManageruser - the user responsible for the tasktaskId - the ID of the taskpublic PageResponse<LongTaskStatus> getAllTasks(@Nullable ConfluenceUser asUser, LimitedRequest request)
LongRunningTaskManagerInternalgetAllTasks in interface LongRunningTaskManagerInternalpublic List<LongTaskStatus> removeComplete()
LongRunningTaskManagerInternalremoveComplete in interface LongRunningTaskManagerInternalpublic int getTaskCount()
LongRunningTaskManagerInternalgetTaskCount in interface LongRunningTaskManagerInternalpublic 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 LongRunningTaskManagertaskId - the ID of the task to remove.public void destroy()
destroy in interface org.springframework.beans.factory.DisposableBeanpublic void stop(long timeout,
TimeUnit unit)
throws TimeoutException
LongRunningTaskManagerstop in interface LongRunningTaskManagertimeout - the time to wait for running tasks to completeunit - the unit of measurement for the timeout parameterTimeoutException - if the timeout is exceededpublic void resume()
LongRunningTaskManagerLongRunningTaskManager.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 LongRunningTaskManagerprotected void taskFinished(LongRunningTaskId taskId)
Copyright © 2003–2022 Atlassian. All rights reserved.