本文整理汇总了Java中org.quartz.JobExecutionContext.get方法的典型用法代码示例。如果您正苦于以下问题:Java JobExecutionContext.get方法的具体用法?Java JobExecutionContext.get怎么用?Java JobExecutionContext.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.JobExecutionContext
的用法示例。
在下文中一共展示了JobExecutionContext.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
ApiFactoryService apiFactoryService = (ApiFactoryService) context.get(ApiFactoryService.class.getName());
try {
EntityManager em = HibernateUtil.getTransactionalEntityManager();
List<DistributedAppliance> das = HibernateUtil.getTransactionControl().required(() -> {
OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(
DistributedAppliance.class, em, StaticRegistry.transactionalBroadcastUtil());
return emgr.listAll();
});
for (DistributedAppliance da : das) {
for (VirtualSystem vs : da.getVirtualSystems()) {
ApplianceManagerConnector apmc = vs.getDistributedAppliance().getApplianceManagerConnector();
ManagerDeviceMemberApi agentApi = apiFactoryService.createManagerDeviceMemberApi(apmc, vs);
if (apiFactoryService.providesDeviceStatus(vs)) {
List<ManagerDeviceMemberStatusElement> agentElems = agentApi.getFullStatus(
vs.getDistributedApplianceInstances().stream()
.map(DistributedApplianceInstanceElementImpl::new)
.collect(Collectors.toList()));
for (DistributedApplianceInstance dai : vs.getDistributedApplianceInstances()) {
getAgentFullStatus(dai, agentElems);
}
}
}
}
} catch (Exception ex) {
log.error("Fail to sync DAs", ex);
}
}
示例2: convert
import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
public CronyxExecutionContext convert(JobExecutionContext context) {
String contextKey = context.get(CONTEXT_KEY).toString();
JobDefinition jobDef = (JobDefinition) context.getMergedJobDataMap().get(JOB_DEFINITION);
TriggerDefinition triggerDef = quartzToCronyxSelector.convert(context.getTrigger());
Instant scheduledTime = context.getScheduledFireTime().toInstant();
Instant actualTime = context.getFireTime().toInstant();
Map<String, Object> jobData = new HashMap<>(context.getMergedJobDataMap());
Throwable jobException = (Throwable) context.get(JOB_EXCEPTION);
Object jobResult = context.getResult();
int attemptNumber = context.getRefireCount() + 1;
return new CronyxExecutionContext(contextKey, jobDef, triggerDef, attemptNumber, scheduledTime,
actualTime, jobData, jobResult, jobException, FIRED);
}