private void updateDSJob(EntityManager em, final DeploymentSpec ds, Job job) {
// TODO: It would be more sensible to make this decision
// using if(txControl.activeTransaction()) {...}
if (em != null) {
ds.setLastJob(em.find(JobRecord.class, job.getId()));
OSCEntityManager.update(em, ds, this.txBroadcastUtil);
} else {
try {
EntityManager txEm = this.dbConnectionManager.getTransactionalEntityManager();
TransactionControl txControl = this.dbConnectionManager.getTransactionControl();
txControl.required(() -> {
DeploymentSpec ds1 = DeploymentSpecEntityMgr.findById(txEm, ds.getId());
if (ds1 != null) {
ds1.setLastJob(txEm.find(JobRecord.class, job.getId()));
OSCEntityManager.update(txEm, ds1, this.txBroadcastUtil);
}
return null;
});
} catch (ScopedWorkException e) {
// Unwrap the ScopedWorkException to get the cause from
// the scoped work (i.e. the executeTransaction() call.
log.error("Fail to update DS job status.", e.getCause());
}
}
}
DeploymentSpecConformJobFactory.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:osc-core
作者:
评论列表
文章目录