当前位置: 首页>>代码示例>>Java>>正文


Java JobExecutionContext.get方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:36,代码来源:ApplianceAgentsJob.java

示例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);
}
 
开发者ID:taboola,项目名称:taboola-cronyx,代码行数:14,代码来源:JobExecutionContextToFiringContext.java


注:本文中的org.quartz.JobExecutionContext.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。