Package com.evolveum.midpoint.model.api
Interface TaskService
-
- All Known Implementing Classes:
ModelController
public interface TaskService
Interface of the Model subsystem that provides task-specific operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
deactivateServiceThreads(long timeToWait, Task operationTask, OperationResult parentResult)
Deactivates service threads (temporarily).void
deleteActivityStateAndWorkers(String rootTaskOid, boolean deleteWorkers, long subtasksWaitTime, Task operationTask, OperationResult parentResult)
String
getRunningTasksThreadsDump(@NotNull Task task, @NotNull OperationResult parentResult)
boolean
getServiceThreadsActivationState()
Returns true if the service threads are running.PrismObject<TaskType>
getTaskByIdentifier(String identifier, Collection<SelectorOptions<GetOperationOptions>> options, Task operationTask, OperationResult parentResult)
Returns information about task, given its identifier.String
getTaskThreadsDump(@NotNull String taskOid, @NotNull Task task, @NotNull OperationResult parentResult)
String
getThreadsDump(@NotNull Task task, @NotNull OperationResult parentResult)
void
reactivateServiceThreads(Task operationTask, OperationResult parentResult)
Re-activates the service threads after they have been deactivated.void
reconcileWorkers(String oid, Task opTask, OperationResult result)
String
recordRunningTasksThreadsDump(String cause, @NotNull Task task, @NotNull OperationResult parentResult)
void
resumeTask(String taskOid, Task operationTask, OperationResult parentResult)
void
resumeTasks(Collection<String> taskOids, Task operationTask, OperationResult parentResult)
Resume suspended tasks.void
resumeTaskTree(String coordinatorOid, Task operationTask, OperationResult parentResult)
void
scheduleTaskNow(String taskOid, Task operationTask, OperationResult parentResult)
void
scheduleTasksNow(Collection<String> taskOids, Task operationTask, OperationResult parentResult)
Schedules a RUNNABLE/CLOSED tasks to be run immediately.void
startSchedulers(Collection<String> nodeIdentifiers, Task operationTask, OperationResult result)
Starts the scheduler on a given nodes.void
stopSchedulers(Collection<String> nodeIdentifiers, Task operationTask, OperationResult parentResult)
Stops the schedulers on a given nodes.boolean
stopSchedulersAndTasks(Collection<String> nodeIdentifiers, long waitTime, 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, Task operationTask, OperationResult parentResult)
void
suspendAndDeleteTasks(Collection<String> taskOids, long waitForStop, boolean alsoSubtasks, Task operationTask, OperationResult parentResult)
Suspends tasks and deletes them.boolean
suspendTask(String taskOid, long waitForStop, Task operationTask, OperationResult parentResult)
boolean
suspendTasks(Collection<String> taskOids, long waitForStop, Task operationTask, OperationResult parentResult)
Suspends a set of tasks.boolean
suspendTaskTree(String taskOid, long waitForStop, Task operationTask, OperationResult parentResult)
void
synchronizeTasks(Task operationTask, OperationResult parentResult)
Synchronizes information in midPoint repository and task scheduling database.
-
-
-
Method Detail
-
suspendTasks
boolean suspendTasks(Collection<String> taskOids, long waitForStop, 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;TaskManager.WAIT_INDEFINITELY
means wait indefinitely,TaskManager.DO_NOT_WAIT
means stop the tasks, but do not wait for finishing their execution,TaskManager.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.- 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, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
suspendTaskTree
boolean suspendTaskTree(String taskOid, long waitForStop, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
suspendAndDeleteTasks
void suspendAndDeleteTasks(Collection<String> taskOids, long waitForStop, boolean alsoSubtasks, 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.TaskManager.WAIT_INDEFINITELY
means wait indefinitely,TaskManager.DO_NOT_WAIT
means stop the tasks, but do not wait for finishing their execution,TaskManager.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?- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
suspendAndDeleteTask
void suspendAndDeleteTask(String taskOid, long waitForStop, boolean alsoSubtasks, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
resumeTasks
void resumeTasks(Collection<String> taskOids, 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:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
resumeTask
void resumeTask(String taskOid, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
resumeTaskTree
void resumeTaskTree(String coordinatorOid, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
scheduleTasksNow
void scheduleTasksNow(Collection<String> taskOids, 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 scheduled- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
scheduleTaskNow
void scheduleTaskNow(String taskOid, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
getTaskByIdentifier
PrismObject<TaskType> getTaskByIdentifier(String identifier, Collection<SelectorOptions<GetOperationOptions>> options, Task operationTask, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, CommunicationException
Returns information about task, given its identifier.
-
deactivateServiceThreads
boolean deactivateServiceThreads(long timeToWait, 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(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, 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, 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;TaskManager.WAIT_INDEFINITELY
means wait indefinitely,TaskManager.DO_NOT_WAIT
means stop the tasks, but do not wait for finishing their execution.- Throws:
SecurityViolationException
ObjectNotFoundException
SchemaException
ExpressionEvaluationException
CommunicationException
ConfigurationException
-
startSchedulers
void startSchedulers(Collection<String> nodeIdentifiers, 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(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).
-
reconcileWorkers
void reconcileWorkers(String oid, Task opTask, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException
-
deleteActivityStateAndWorkers
void deleteActivityStateAndWorkers(String rootTaskOid, boolean deleteWorkers, long subtasksWaitTime, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
getThreadsDump
String getThreadsDump(@NotNull @NotNull Task task, @NotNull @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
getRunningTasksThreadsDump
String getRunningTasksThreadsDump(@NotNull @NotNull Task task, @NotNull @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
recordRunningTasksThreadsDump
String recordRunningTasksThreadsDump(String cause, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException
-
getTaskThreadsDump
String getTaskThreadsDump(@NotNull @NotNull String taskOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult parentResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
-