use of org.quartz.core.jmx.QuartzSchedulerMBean in project midpoint by Evolveum.
the class RemoteNodesManager method redirectTaskToNode.
public void redirectTaskToNode(@NotNull Task task, @NotNull NodeType node, @NotNull OperationResult result) {
LOGGER.trace("Trying to schedule task {} on {}", task, node.getNodeIdentifier());
Holder<JMXConnector> connectorHolder = new Holder<>();
try {
QuartzSchedulerMBean mbeanProxy = getSchedulerBean(node, connectorHolder, result);
if (mbeanProxy != null) {
try {
createStarterJobIfNeeded();
mbeanProxy.triggerJob(STARTER_JOB_KEY.getName(), STARTER_JOB_KEY.getGroup(), Collections.singletonMap(JobStarter.TASK_OID, task.getOid()));
LOGGER.debug("Successfully requested start of " + task + " at " + getClusterManager().dumpNodeInfo(node));
result.recordSuccessIfUnknown();
} catch (Exception e) {
// necessary because of mbeanProxy
String message = "Cannot schedule " + task + " at " + getClusterManager().dumpNodeInfo(node);
LoggingUtils.logUnexpectedException(LOGGER, message, e);
result.recordFatalError(message + ":" + e.getMessage(), e);
}
} else {
LOGGER.warn("Couldn't obtain Quartz MBean so couldn't reschedule task {} on {}", task, node.getNodeIdentifier());
}
} finally {
closeJmxConnection(connectorHolder, getClusterManager().dumpNodeInfo(node));
}
}
Aggregations