Class RemoteTaskManager
- java.lang.Object
-
- org.wso2.carbon.ntask.core.impl.remote.RemoteTaskManager
-
- All Implemented Interfaces:
TaskManager
public class RemoteTaskManager extends Object implements TaskManager
This class represents a remote task manager implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RemoteTaskManager.TaskStatusMessage
This class represents the cluster message for retrieving a task status.static class
RemoteTaskManager.TaskStatusResult
This class represents a clustering message result for task statuses.-
Nested classes/interfaces inherited from interface org.wso2.carbon.ntask.core.TaskManager
TaskManager.TaskState
-
-
Field Summary
Fields Modifier and Type Field Description static String
REMOTE_TASK_ID_REPO_PROP
static String
REMOTE_TASK_SERVER_ADDRESS
static String
REMOTE_TASK_SERVER_PASSWORD
static String
REMOTE_TASK_SERVER_USERNAME
static String
TASK_CLIENT_DISPATCH_ADDRESS
-
Constructor Summary
Constructors Constructor Description RemoteTaskManager(TaskRepository taskRepository, org.wso2.carbon.remotetasks.stub.admin.common.RemoteTaskAdmin remoteTaskAdmin)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addRunningTask(String runningTaskId)
boolean
deleteTask(String taskName)
Stops and deletes a task with the given name.List<TaskInfo>
getAllTasks()
Get all task information.org.wso2.carbon.remotetasks.stub.admin.common.RemoteTaskAdmin
getRemoteTaskAdmin()
TaskInfo
getTask(String taskName)
Get task information.TaskRepository
getTaskRepository()
TaskManager.TaskState
getTaskState(String taskName)
Gets tasks state informationTaskManager.TaskState
getTaskStateRemote(String taskName)
String
getTaskType()
int
getTenantId()
void
initStartupTasks()
Initialize the startup tasks.static boolean
isRunningTaskExist(String runningTaskId)
boolean
isTaskRunning(String taskName)
boolean
isTaskScheduled(String taskName)
Checks if the given task is already scheduled.void
pauseTask(String taskName)
Pauses a task with the given name.void
registerLocalTaskActionListener(LocalTaskActionListener listener, String taskName)
Registers a listener to be notified when an action is performed on a task.void
registerTask(TaskInfo taskInfo)
Registers a new task or updates if one already exists.static void
removeRunningTask(String runningTaskId)
void
rescheduleTask(String taskName)
Reschedules a task with the given name, only the trigger information will be updated in the reschedule.void
resumeTask(String taskName)
Resumes a paused task with the given name.void
runTask(String taskName)
void
scheduleTask(String taskName)
Starts a task with the given name.
-
-
-
Field Detail
-
REMOTE_TASK_SERVER_ADDRESS
public static final String REMOTE_TASK_SERVER_ADDRESS
- See Also:
- Constant Field Values
-
REMOTE_TASK_SERVER_USERNAME
public static final String REMOTE_TASK_SERVER_USERNAME
- See Also:
- Constant Field Values
-
REMOTE_TASK_SERVER_PASSWORD
public static final String REMOTE_TASK_SERVER_PASSWORD
- See Also:
- Constant Field Values
-
TASK_CLIENT_DISPATCH_ADDRESS
public static final String TASK_CLIENT_DISPATCH_ADDRESS
- See Also:
- Constant Field Values
-
REMOTE_TASK_ID_REPO_PROP
public static final String REMOTE_TASK_ID_REPO_PROP
- See Also:
- Constant Field Values
-
-
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()
-
getTaskRepository
public TaskRepository getTaskRepository()
-
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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- 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 interfaceTaskManager
- Parameters:
listener
- the listener to be notifiedtaskName
- the name of the task for which the listener should be registered
-
-