Package com.evolveum.midpoint.model.api
Interface TaskService
-
public interface TaskService
Interface of the Model subsystem that provides task-specific operations.- Author:
- mederly
-
-
Field Summary
Fields Modifier and Type Field Description static long
DO_NOT_STOP
static long
DO_NOT_WAIT
static long
WAIT_INDEFINITELY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
deactivateServiceThreads(long timeToWait, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Deactivates service threads (temporarily).void
deleteWorkersAndWorkState(String rootTaskOid, boolean deleteWorkers, long subtasksWaitTime, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
List<String>
getAllTaskCategories()
Gets a list of all task categories.String
getHandlerUriForCategory(String category)
Returns a default handler URI for a given task category.String
getRunningTasksThreadsDump(com.evolveum.midpoint.task.api.Task task, OperationResult parentResult)
boolean
getServiceThreadsActivationState()
Returns true if the service threads are running.PrismObject<TaskType>
getTaskByIdentifier(String identifier, Collection<SelectorOptions<GetOperationOptions>> options, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Returns information about task, given its identifier.String
getTaskThreadsDump(String taskOid, com.evolveum.midpoint.task.api.Task task, OperationResult parentResult)
String
getThreadsDump(com.evolveum.midpoint.task.api.Task task, OperationResult parentResult)
void
reactivateServiceThreads(com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Re-activates the service threads after they have been deactivated.void
reconcileWorkers(String oid, com.evolveum.midpoint.task.api.Task opTask, OperationResult result)
String
recordRunningTasksThreadsDump(String cause, com.evolveum.midpoint.task.api.Task task, OperationResult parentResult)
void
resumeTask(String taskOid, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
void
resumeTasks(Collection<String> taskOids, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Resume suspended tasks.void
resumeTaskTree(String coordinatorOid, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
void
scheduleTaskNow(String taskOid, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
void
scheduleTasksNow(Collection<String> taskOids, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Schedules a RUNNABLE/CLOSED tasks to be run immediately.void
startSchedulers(Collection<String> nodeIdentifiers, com.evolveum.midpoint.task.api.Task operationTask, OperationResult result)
Starts the scheduler on a given nodes.void
stopSchedulers(Collection<String> nodeIdentifiers, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Stops the schedulers on a given nodes.boolean
stopSchedulersAndTasks(Collection<String> nodeIdentifiers, long waitTime, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Stops a set of schedulers (on their nodes) and tasks that are executing on these nodes.void
suspendAndDeleteTask(String taskOid, long waitForStop, boolean alsoSubtasks, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
void
suspendAndDeleteTasks(Collection<String> taskOids, long waitForStop, boolean alsoSubtasks, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Suspends tasks and deletes them.boolean
suspendTask(String taskOid, long waitForStop, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
boolean
suspendTasks(Collection<String> taskOids, long waitForStop, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Suspends a set of tasks.boolean
suspendTaskTree(String taskOid, long waitForStop, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
void
synchronizeTasks(com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult)
Synchronizes information in midPoint repository and task scheduling database.
-
-
-
Field Detail
-
WAIT_INDEFINITELY
static final long WAIT_INDEFINITELY
- See Also:
- Constant Field Values
-
DO_NOT_WAIT
static final long DO_NOT_WAIT
- See Also:
- Constant Field Values
-
DO_NOT_STOP
static final long DO_NOT_STOP
- See Also:
- Constant Field Values
-
-
Method Detail
-
suspendTasks
boolean suspendTasks(Collection<String> taskOids, long waitForStop, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Suspends a set of tasks. Sets their execution status to SUSPENDED. Stops their execution (unless doNotStop is set).- Parameters:
taskOids
- a collection of OIDs of tasks that have to be suspendedwaitForStop
- how long (in milliseconds) to wait for stopping the execution of tasks; WAIT_INDEFINITELY means wait indefinitely DO_NOT_WAIT means stop the tasks, but do not wait for finishing their execution DO_NOT_STOP means do not try to stop the task execution. Tasks will only be put into SUSPENDED state, and their executions (if any) will be left as they are. Use this option only when you know what you're doing.operationTask
- Task in which the operation is executed. NOT the task that be being operated on.parentResult
-- Returns:
- true if all the tasks were stopped, false if some tasks continue to run or if stopping was not requested (DO_NOT_STOP option)
- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
suspendTask
boolean suspendTask(String taskOid, long waitForStop, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
suspendTaskTree
boolean suspendTaskTree(String taskOid, long waitForStop, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
suspendAndDeleteTasks
void suspendAndDeleteTasks(Collection<String> taskOids, long waitForStop, boolean alsoSubtasks, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Suspends tasks and deletes them.- Parameters:
taskOids
- Collection of task OIDs to be suspended and deleted.waitForStop
- How long (in milliseconds) to wait for task stop before proceeding with deletion. WAIT_INDEFINITELY means wait indefinitely DO_NOT_WAIT means stop the tasks, but do not wait for finishing their execution DO_NOT_STOP means do not try to stop the task execution. Tasks will only be put into SUSPENDED state, and their executions (if any) will be left as they are. Use this option only when you know what you're doing.alsoSubtasks
- Should also subtasks be deleted?parentResult
-- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
suspendAndDeleteTask
void suspendAndDeleteTask(String taskOid, long waitForStop, boolean alsoSubtasks, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
resumeTasks
void resumeTasks(Collection<String> taskOids, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Resume suspended tasks.- Parameters:
taskOids
- a collection of OIDs of tasks that have to be resumed- Throws:
SchemaException
ObjectNotFoundException
SecurityViolationException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
resumeTask
void resumeTask(String taskOid, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
resumeTaskTree
void resumeTaskTree(String coordinatorOid, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
scheduleTasksNow
void scheduleTasksNow(Collection<String> taskOids, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Schedules a RUNNABLE/CLOSED tasks to be run immediately. (If a task will really start immediately, depends e.g. on whether a scheduler is started, whether there are available threads, and so on.)- Parameters:
taskOids
- a collection of OIDs of tasks that have to be scheduledparentResult
-- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
scheduleTaskNow
void scheduleTaskNow(String taskOid, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
getTaskByIdentifier
PrismObject<TaskType> getTaskByIdentifier(String identifier, Collection<SelectorOptions<GetOperationOptions>> options, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, CommunicationException
Returns information about task, given its identifier.- Parameters:
identifier
-options
-parentResult
-- Returns:
- Throws:
SchemaException
ObjectNotFoundException
ConfigurationException
SecurityViolationException
ExpressionEvaluationException
CommunicationException
-
deactivateServiceThreads
boolean deactivateServiceThreads(long timeToWait, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SchemaException, SecurityViolationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Deactivates service threads (temporarily). This will suspend all background activity such as scanning threads, heartbeats and similar mechanisms. Note: The threads are normally activated after task manager implementation starts. This methods should not be used in a normal case. WARNING: this feature is intended for development-time diagnostics and should not be used on production environments. Suspending the threads may affect correct behavior of the system (such as timeouts on heartbeats). Use this feature only if you really know what you are doing. timeToWait is only for orientation = it may be so that the implementation would wait 2 or 3 times this value (if it waits separately for several threads completion)
-
reactivateServiceThreads
void reactivateServiceThreads(com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SchemaException, SecurityViolationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Re-activates the service threads after they have been deactivated.
-
getServiceThreadsActivationState
boolean getServiceThreadsActivationState()
Returns true if the service threads are running. This method returns true in a normal case. It returns false is the threads were temporarily suspended.- Returns:
- true if the service threads are running.
-
stopSchedulers
void stopSchedulers(Collection<String> nodeIdentifiers, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Stops the schedulers on a given nodes. This means that at that nodes no tasks will be started.- Parameters:
nodeIdentifiers
- Nodes on which the schedulers should be stopped.- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
stopSchedulersAndTasks
boolean stopSchedulersAndTasks(Collection<String> nodeIdentifiers, long waitTime, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Stops a set of schedulers (on their nodes) and tasks that are executing on these nodes.- Parameters:
nodeIdentifiers
- collection of node identifierswaitTime
- how long to wait for task shutdown, in milliseconds WAIT_INDEFINITELY means wait indefinitely DO_NOT_WAIT means stop the tasks, but do not wait for finishing their executionparentResult
-- Returns:
- Throws:
ExpressionEvaluationException
SecurityViolationException
ObjectNotFoundException
SchemaException
CommunicationException
ConfigurationException
-
startSchedulers
void startSchedulers(Collection<String> nodeIdentifiers, com.evolveum.midpoint.task.api.Task operationTask, OperationResult result) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Starts the scheduler on a given nodes. A prerequisite is that nodes are running and their TaskManagers are not in an error state.- Parameters:
nodeIdentifiers
- Nodes on which the scheduler should be started.- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
synchronizeTasks
void synchronizeTasks(com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SchemaException, SecurityViolationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException
Synchronizes information in midPoint repository and task scheduling database. Not needed to use during normal operation (only when problems occur).- Parameters:
parentResult
-- Throws:
SchemaException
SecurityViolationException
ObjectNotFoundException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
getAllTaskCategories
List<String> getAllTaskCategories()
Gets a list of all task categories. TODO consider removing this method- Returns:
-
getHandlerUriForCategory
String getHandlerUriForCategory(String category)
Returns a default handler URI for a given task category. TODO consider removing this method (currently used for task creation via GUI)- Parameters:
category
-- Returns:
-
reconcileWorkers
void reconcileWorkers(String oid, com.evolveum.midpoint.task.api.Task opTask, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException
-
deleteWorkersAndWorkState
void deleteWorkersAndWorkState(String rootTaskOid, boolean deleteWorkers, long subtasksWaitTime, com.evolveum.midpoint.task.api.Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
getThreadsDump
String getThreadsDump(@NotNull com.evolveum.midpoint.task.api.Task task, @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
getRunningTasksThreadsDump
String getRunningTasksThreadsDump(@NotNull com.evolveum.midpoint.task.api.Task task, @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
recordRunningTasksThreadsDump
String recordRunningTasksThreadsDump(String cause, @NotNull com.evolveum.midpoint.task.api.Task task, @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException
-
getTaskThreadsDump
String getTaskThreadsDump(@NotNull String taskOid, @NotNull com.evolveum.midpoint.task.api.Task task, @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
-