Class RemoteTaskManager

  • All Implemented Interfaces:
    TaskManager

    public class RemoteTaskManager
    extends Object
    implements TaskManager
    This class represents a remote task manager implementation.
    • Constructor Detail

      • RemoteTaskManager

        public RemoteTaskManager​(TaskRepository taskRepository,
                                 org.wso2.carbon.remotetasks.stub.admin.common.RemoteTaskAdmin remoteTaskAdmin)
    • Method Detail

      • getRemoteTaskAdmin

        public org.wso2.carbon.remotetasks.stub.admin.common.RemoteTaskAdmin getRemoteTaskAdmin()
      • getTenantId

        public int getTenantId()
      • getTaskType

        public String getTaskType()
      • initStartupTasks

        public void initStartupTasks()
                              throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Initialize the startup tasks.
        Specified by:
        initStartupTasks in interface TaskManager
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • scheduleTask

        public void scheduleTask​(String taskName)
                          throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Starts a task with the given name.
        Specified by:
        scheduleTask in interface TaskManager
        Parameters:
        taskName - The name of the task
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • rescheduleTask

        public void rescheduleTask​(String taskName)
                            throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Reschedules a task with the given name, only the trigger information will be updated in the reschedule.
        Specified by:
        rescheduleTask in interface TaskManager
        Parameters:
        taskName - The task to be rescheduled
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • deleteTask

        public boolean deleteTask​(String taskName)
                           throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Stops and deletes a task with the given name.
        Specified by:
        deleteTask in interface TaskManager
        Parameters:
        taskName - The name of the task
        Returns:
        true if the task was found and deleted
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • pauseTask

        public void pauseTask​(String taskName)
                       throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Pauses a task with the given name.
        Specified by:
        pauseTask in interface TaskManager
        Parameters:
        taskName - The name of the task
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • resumeTask

        public void resumeTask​(String taskName)
                        throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Resumes a paused task with the given name.
        Specified by:
        resumeTask in interface TaskManager
        Parameters:
        taskName - The name of the task
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • registerTask

        public void registerTask​(TaskInfo taskInfo)
                          throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Registers a new task or updates if one already exists.
        Specified by:
        registerTask in interface TaskManager
        Parameters:
        taskInfo - The task information
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTaskStateRemote

        public TaskManager.TaskState getTaskStateRemote​(String taskName)
                                                 throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTaskState

        public TaskManager.TaskState getTaskState​(String taskName)
                                           throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Gets tasks state information
        Specified by:
        getTaskState in interface TaskManager
        Parameters:
        taskName - The name of the task
        Returns:
        State of the task
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTask

        public TaskInfo getTask​(String taskName)
                         throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Get task information.
        Specified by:
        getTask in interface TaskManager
        Parameters:
        taskName - The name of the task
        Returns:
        The task information
        Throws:
        org.wso2.carbon.ntask.common.TaskException - if the task cannot be found
      • getAllTasks

        public List<TaskInfo> getAllTasks()
                                   throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Get all task information.
        Specified by:
        getAllTasks in interface TaskManager
        Returns:
        Task information list
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • isTaskScheduled

        public boolean isTaskScheduled​(String taskName)
                                throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskManager
        Checks if the given task is already scheduled.
        Specified by:
        isTaskScheduled in interface TaskManager
        Parameters:
        taskName - The task name
        Returns:
        true if already scheduled
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • runTask

        public void runTask​(String taskName)
                     throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • addRunningTask

        public static void addRunningTask​(String runningTaskId)
      • removeRunningTask

        public static void removeRunningTask​(String runningTaskId)
      • isRunningTaskExist

        public static boolean isRunningTaskExist​(String runningTaskId)
      • isTaskRunning

        public boolean isTaskRunning​(String taskName)
                              throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • registerLocalTaskActionListener

        public void registerLocalTaskActionListener​(LocalTaskActionListener listener,
                                                    String taskName)
        Description copied from interface: TaskManager
        Registers a listener to be notified when an action is performed on a task.
        Specified by:
        registerLocalTaskActionListener in interface TaskManager
        Parameters:
        listener - the listener to be notified
        taskName - the name of the task for which the listener should be registered