com.atlassian.jira.task
Class ImportTaskManagerImpl

java.lang.Object
  extended by com.atlassian.jira.task.ImportTaskManagerImpl
All Implemented Interfaces:
ImportTaskManager

public class ImportTaskManagerImpl
extends Object
implements ImportTaskManager

An implementation of a ImportTaskManager. This manager uses an ExecutorService to run submitted tasks. It should have *no* external dependencies and should *not* be injectable!

Since:
4.4

Constructor Summary
ImportTaskManagerImpl()
           
 
Method Summary
<V> TaskDescriptor<V>
getTask()
          Returns the TaskDescriptor of the current import task that's running
 void shutdownNow()
          Attempts to aggressively stop the executing tasks and shuts down the underlying thread pool.
<V> TaskDescriptor<V>
submitTask(Callable<V> callable, String taskName)
          This submits a Callable task to the manager which can then be started at the managers discretion, but hopefully very soon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportTaskManagerImpl

public ImportTaskManagerImpl()
Method Detail

submitTask

public <V> TaskDescriptor<V> submitTask(@NotNull
                                        Callable<V> callable,
                                        String taskName)
                             throws RejectedExecutionException,
                                    AlreadyExecutingException
Description copied from interface: ImportTaskManager
This submits a Callable task to the manager which can then be started at the managers discretion, but hopefully very soon. The TaskDescriptor returned is a snapshot of the task's state when the method returns and will not change to reflect the task's future state changes.

Specified by:
submitTask in interface ImportTaskManager
Parameters:
callable - the long running task
taskName - An i18nized string describing this task
Returns:
a TaskDescriptor for the new long running task. The returned descriptor is a snapshot of the task state when the method returns and will not reflect any future changes.
Throws:
RejectedExecutionException - if the task manager is being shutdown and cannot accept new tasks.
AlreadyExecutingException - if another import task is already running in the task manager.

shutdownNow

public void shutdownNow()
Description copied from interface: ImportTaskManager
Attempts to aggressively stop the executing tasks and shuts down the underlying thread pool.

Specified by:
shutdownNow in interface ImportTaskManager

getTask

public <V> TaskDescriptor<V> getTask()
Description copied from interface: ImportTaskManager
Returns the TaskDescriptor of the current import task that's running

Specified by:
getTask in interface ImportTaskManager
Returns:
a TaskDescriptor or null if the manager has not such task. The descriptor returned is a snapshot of the task state when the method returns will not reflect any future changes. null will be returned when no matching task can be found.


Copyright © 2002-2013 Atlassian. All Rights Reserved.