// if we fail wakeup-execution for any reason, avoid release sync-source if there is any
job.setSyncSource(null);
return;
}
AsyncJobJoinMapVO joinRecord = joinRecords.get(0);
VmWorkJobVO joinedJob = _workjobDao.findById(joinRecord.getJoinJobId());
Class<?> workClz = null;
try {
workClz = Class.forName(job.getCmd());
} catch (ClassNotFoundException e) {
s_logger.error("VM work class " + job.getCmd() + " is not found", e);
return;
}
// get original work context information from joined job
VmWork work = VmWorkSerializer.deserialize(workClz, joinedJob.getCmdInfo());
assert (work != null);
AccountVO account = _accountDao.findById(work.getAccountId());
assert (account != null);
VMInstanceVO vm = _instanceDao.findById(work.getVmId());
assert (vm != null);
CallContext.register(work.getUserId(), work.getAccountId(), job.getRelated());
try {
Method handler = getHandler(joinRecord.getWakeupHandler());
if (handler != null) {
handler.invoke(_vmMgr);
} else {
assert (false);
s_logger.error("Unable to find wakeup handler " + joinRecord.getWakeupHandler() +
" when waking up job-" + job.getId());
}
} finally {
CallContext.unregister();
}