|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.evolveum.midpoint.task.quartzimpl.TaskManagerQuartzImpl
@Service(value="taskManager") @DependsOn(value="repositoryService") public class TaskManagerQuartzImpl
Task Manager implementation using Quartz scheduler. Main classes: - TaskManagerQuartzImpl - TaskQuartzImpl Helper classes: - ExecutionManager: node-related functions (start, stop, query status), task-related functions (stop, query status) - LocalNodeManager and RemoteExecutionManager (specific methods for local node and remote nodes) - TaskManagerConfiguration: access to config gathered from various places (midpoint config, sql repo config, system properties) - ClusterManager: keeps cluster nodes synchronized and verifies cluster configuration sanity - JmxClient: used to invoke remote JMX agents - JmxServer: provides a JMX agent for midPoint - TaskSynchronizer: synchronizes information about tasks between midPoint repo and Quartz Job Store - Initializer: contains TaskManager initialization code (quite complex)
Constructor Summary | |
---|---|
TaskManagerQuartzImpl()
|
Method Summary | |
---|---|
String |
addTask(PrismObject<TaskType> taskPrism,
OperationResult parentResult)
Add new task. |
void |
closeTask(Task task,
OperationResult parentResult)
|
void |
closeTaskWithoutSavingState(Task task,
OperationResult parentResult)
|
int |
countNodes(ObjectQuery query,
OperationResult result)
|
int |
countTasks(ObjectQuery query,
OperationResult result)
|
Task |
createTaskInstance()
Creates new transient, running, claimed task instance. |
Task |
createTaskInstance(PrismObject<TaskType> taskPrism,
OperationResult parentResult)
Creates task instance from the XML task representation. |
Task |
createTaskInstance(PrismObject<TaskType> taskPrism,
String operationName,
OperationResult parentResult)
Creates task instance from the XML task representation. |
Task |
createTaskInstance(String operationName)
Creates new transient, running, claimed task instance. |
boolean |
deactivateServiceThreads(long timeToWait,
OperationResult parentResult)
Deactivate service threads (temporarily). |
void |
deleteNode(String nodeIdentifier,
OperationResult result)
|
void |
deleteTask(String oid,
OperationResult parentResult)
Deletes task with provided OID. |
List<String> |
getAllTaskCategories()
|
org.springframework.beans.factory.BeanFactory |
getBeanFactory()
|
ClusterManager |
getClusterManager()
|
TaskManagerConfiguration |
getConfiguration()
|
ExecutionManager |
getExecutionManager()
|
TaskHandler |
getHandler(String uri)
|
String |
getHandlerUriForCategory(String category)
|
NodeErrorStatus |
getLocalNodeErrorStatus()
|
MidpointConfiguration |
getMidpointConfiguration()
|
Long |
getNextRunStartTime(String oid,
OperationResult parentResult)
|
String |
getNodeId()
|
PrismContext |
getPrismContext()
|
RepositoryService |
getRepositoryService()
|
Set<Task> |
getRunningTasks()
Deprecated. |
ClusterStatusInformation |
getRunningTasksClusterwide(long allowedAge,
OperationResult parentResult)
Returns running tasks; fetches new information only if after last query elapsed at least 'allowedAge' milliseconds. |
ClusterStatusInformation |
getRunningTasksClusterwide(OperationResult parentResult)
|
boolean |
getServiceThreadsActivationState()
Returns true if the service threads are running. |
Task |
getTask(String taskOid,
OperationResult parentResult)
Returns a task with specified OID. |
void |
init()
Initialization. |
boolean |
isCurrentNode(PrismObject<NodeType> node)
|
boolean |
isInErrorState()
|
void |
modifyTask(String oid,
Collection<? extends ItemDelta> modifications,
OperationResult parentResult)
Deprecated. |
void |
onTaskCreate(String oid,
OperationResult parentResult)
This is a signal to task manager that a new task was created in the repository. |
void |
onTaskDelete(String oid,
OperationResult parentResult)
This is a signal to task manager that a task was removed from the repository. |
void |
postInit(OperationResult parentResult)
Post initialization, e.g. |
void |
reactivateServiceThreads(OperationResult parentResult)
Re-activate the service threads after they have been deactivated. |
void |
registerHandler(String uri,
TaskHandler handler)
Register a handler for a specified handler URI. |
void |
resumeTask(Task task,
OperationResult parentResult)
Resume suspended task. |
void |
scheduleTaskNow(Task task,
OperationResult parentResult)
|
List<Node> |
searchNodes(ObjectQuery query,
ClusterStatusInformation clusterStatusInformation,
OperationResult parentResult)
Returns relevant nodes (w.r.t query and paging specification). |
List<Task> |
searchTasks(ObjectQuery query,
ClusterStatusInformation clusterStatusInformation,
OperationResult parentResult)
Returns relevant tasks (w.r.t. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
|
void |
setConfiguration(TaskManagerConfiguration configuration)
|
void |
setNodeErrorStatus(NodeErrorStatus nodeErrorStatus)
|
void |
shutdown()
Make sure all processes are stopped properly. |
void |
startScheduler(String nodeIdentifier,
OperationResult parentResult)
Starts the scheduler on a given node. |
void |
stopScheduler(String nodeIdentifier,
OperationResult parentResult)
Stops the scheduler on a given node. |
boolean |
stopSchedulersAndTasks(List<String> nodeList,
long timeToWait,
OperationResult result)
|
boolean |
suspendTask(Task task,
long waitTime,
boolean doNotStop,
OperationResult parentResult)
|
boolean |
suspendTask(Task task,
long waitTime,
OperationResult parentResult)
Suspend task. |
boolean |
suspendTasks(Collection<Task> tasks,
long waitTime,
boolean doNotStop,
OperationResult parentResult)
|
boolean |
suspendTasks(Collection<Task> tasks,
long waitTime,
OperationResult parentResult)
|
void |
switchToBackground(Task task,
OperationResult parentResult)
Switches the provided task to background, making it asynchronous. |
void |
synchronizeTasks(OperationResult result)
|
void |
unpauseTask(Task task,
OperationResult parentResult)
|
void |
unscheduleTask(Task task,
OperationResult parentResult)
|
ParseException |
validateCronExpression(String cron)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TaskManagerQuartzImpl()
Method Detail |
---|
@PostConstruct public void init()
public void postInit(OperationResult parentResult)
TaskManager
postInit
in interface TaskManager
@PreDestroy public void shutdown()
TaskManager
shutdown
in interface TaskManager
public boolean isInErrorState()
public boolean deactivateServiceThreads(long timeToWait, OperationResult parentResult)
TaskManager
deactivateServiceThreads
in interface TaskManager
public void reactivateServiceThreads(OperationResult parentResult)
TaskManager
reactivateServiceThreads
in interface TaskManager
public boolean getServiceThreadsActivationState()
TaskManager
getServiceThreadsActivationState
in interface TaskManager
public boolean suspendTask(Task task, long waitTime, OperationResult parentResult)
TaskManager
suspendTask
in interface TaskManager
task
- task instance to claimpublic boolean suspendTask(Task task, long waitTime, boolean doNotStop, OperationResult parentResult)
public boolean suspendTasks(Collection<Task> tasks, long waitTime, OperationResult parentResult)
suspendTasks
in interface TaskManager
public boolean suspendTasks(Collection<Task> tasks, long waitTime, boolean doNotStop, OperationResult parentResult)
suspendTasks
in interface TaskManager
public void unpauseTask(Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
unpauseTask
in interface TaskManager
ObjectNotFoundException
SchemaException
public void resumeTask(Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
TaskManager
resumeTask
in interface TaskManager
task
- task instance to claim
ObjectNotFoundException
SchemaException
public Task createTaskInstance()
TaskManager
createTaskInstance
in interface TaskManager
public Task createTaskInstance(String operationName)
TaskManager
createTaskInstance
in interface TaskManager
operationName
- operation name to use as a root for new result in task
public Task createTaskInstance(PrismObject<TaskType> taskPrism, OperationResult parentResult) throws SchemaException
TaskManager
createTaskInstance
in interface TaskManager
taskPrism
- JAXB (XML) representation of the task
SchemaException
- The provided taskType is not compliant to schemapublic Task createTaskInstance(PrismObject<TaskType> taskPrism, String operationName, OperationResult parentResult) throws SchemaException
TaskManager
createTaskInstance
in interface TaskManager
taskPrism
- Prism representation of the taskoperationName
- operation name to use as a root for new result in task
SchemaException
- The provided taskType is not compliant to schemapublic Task getTask(String taskOid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
TaskManager
getTask
in interface TaskManager
taskOid
- OID of the persistent task.
ObjectNotFoundException
- wrong OID format, etc.
SchemaException
- error dealing with resource schemapublic void switchToBackground(Task task, OperationResult parentResult)
TaskManager
switchToBackground
in interface TaskManager
task
- task to switch to background.public String addTask(PrismObject<TaskType> taskPrism, OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException
TaskManager
addTask
in interface TaskManager
taskPrism
- object to createparentResult
- parent OperationResult (in/out)
ObjectAlreadyExistsException
- object with specified identifiers already exists, cannot add
SchemaException
- error dealing with storage schema, e.g. schema violation@Deprecated public void modifyTask(String oid, Collection<? extends ItemDelta> modifications, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
TaskManager
modifyTask
in interface TaskManager
oid
- OID of the task to be changedmodifications
- specification of object changesparentResult
- parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not exist
SchemaException
- resulting object would violate the schemapublic void deleteTask(String oid, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
TaskManager
deleteTask
in interface TaskManager
oid
- OID of object to deleteparentResult
- parent OperationResult (in/out)
ObjectNotFoundException
- specified object does not exist
SchemaException
public Long getNextRunStartTime(String oid, OperationResult parentResult)
getNextRunStartTime
in interface TaskManager
public int countNodes(ObjectQuery query, OperationResult result) throws SchemaException
countNodes
in interface TaskManager
SchemaException
public List<Node> searchNodes(ObjectQuery query, ClusterStatusInformation clusterStatusInformation, OperationResult parentResult) throws SchemaException
TaskManager
searchNodes
in interface TaskManager
clusterStatusInformation
- The same as in searchTasks.
SchemaException
public List<Task> searchTasks(ObjectQuery query, ClusterStatusInformation clusterStatusInformation, OperationResult parentResult) throws SchemaException
TaskManager
searchTasks
in interface TaskManager
query
- Search queryclusterStatusInformation
- If null, the method will query cluster nodes to get up-to-date runtime information.
If non-null, the method will use the provided information. Used to optimize
network traffic in case of repeating calls to searchTasks/searchNodes (e.g. when
displaying them on one page).
SchemaException
public int countTasks(ObjectQuery query, OperationResult result) throws SchemaException
countTasks
in interface TaskManager
SchemaException
public void registerHandler(String uri, TaskHandler handler)
TaskManager
registerHandler
in interface TaskManager
public TaskHandler getHandler(String uri)
public List<String> getAllTaskCategories()
getAllTaskCategories
in interface TaskManager
public String getHandlerUriForCategory(String category)
getHandlerUriForCategory
in interface TaskManager
public void onTaskCreate(String oid, OperationResult parentResult)
TaskManager
onTaskCreate
in interface TaskManager
public void onTaskDelete(String oid, OperationResult parentResult)
TaskManager
onTaskDelete
in interface TaskManager
public TaskManagerConfiguration getConfiguration()
public PrismContext getPrismContext()
public NodeErrorStatus getLocalNodeErrorStatus()
public void setNodeErrorStatus(NodeErrorStatus nodeErrorStatus)
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
org.springframework.beans.BeansException
public MidpointConfiguration getMidpointConfiguration()
public org.springframework.beans.factory.BeanFactory getBeanFactory()
public ClusterManager getClusterManager()
public RepositoryService getRepositoryService()
public void setConfiguration(TaskManagerConfiguration configuration)
public ExecutionManager getExecutionManager()
public void synchronizeTasks(OperationResult result)
synchronizeTasks
in interface TaskManager
public String getNodeId()
getNodeId
in interface TaskManager
@Deprecated public Set<Task> getRunningTasks() throws TaskManagerException
TaskManager
getRunningTasks
in interface TaskManager
TaskManagerException
public void stopScheduler(String nodeIdentifier, OperationResult parentResult)
TaskManager
stopScheduler
in interface TaskManager
nodeIdentifier
- Node on which the scheduler should be stopped. Null means current node.public void startScheduler(String nodeIdentifier, OperationResult parentResult)
TaskManager
startScheduler
in interface TaskManager
nodeIdentifier
- Node on which the scheduler should be started. Null means current node.public boolean stopSchedulersAndTasks(List<String> nodeList, long timeToWait, OperationResult result)
stopSchedulersAndTasks
in interface TaskManager
public ClusterStatusInformation getRunningTasksClusterwide(OperationResult parentResult)
getRunningTasksClusterwide
in interface TaskManager
public ClusterStatusInformation getRunningTasksClusterwide(long allowedAge, OperationResult parentResult)
TaskManager
getRunningTasksClusterwide
in interface TaskManager
public boolean isCurrentNode(PrismObject<NodeType> node)
isCurrentNode
in interface TaskManager
public void deleteNode(String nodeIdentifier, OperationResult result)
deleteNode
in interface TaskManager
public void scheduleTaskNow(Task task, OperationResult parentResult)
scheduleTaskNow
in interface TaskManager
public void unscheduleTask(Task task, OperationResult parentResult)
public void closeTask(Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException
ObjectNotFoundException
SchemaException
public void closeTaskWithoutSavingState(Task task, OperationResult parentResult)
public ParseException validateCronExpression(String cron)
validateCronExpression
in interface TaskManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |