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


Java JobExecutionContext.getResult方法代码示例

本文整理汇总了Java中org.quartz.JobExecutionContext.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java JobExecutionContext.getResult方法的具体用法?Java JobExecutionContext.getResult怎么用?Java JobExecutionContext.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.JobExecutionContext的用法示例。


在下文中一共展示了JobExecutionContext.getResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.quartz.JobExecutionContext; //导入方法依赖的package包/类
/**
 * @param context      {@link JobExecutionContext}
 * @param jobException {@link JobExecutionException}
 */
@Trace(metricName = "JobListener{save}", async = true, dispatcher = true)
private void save(JobExecutionContext context, JobExecutionException jobException) throws IOException {
    JobResult jobResult = (JobResult) context.getResult();
    ExecutionStatusEntity.ExecutionStatusEntityBuilder builder = ExecutionStatusEntity.builder();
    builder.created(new Date());
    builder.nextFireTime(context.getNextFireTime());
    builder.fireTime(context.getFireTime());
    builder.jobRunTime(context.getJobRunTime());
    builder.prevFireTime(context.getPreviousFireTime());
    builder.scheduledFireTime(context.getScheduledFireTime());
    if (jobResult != null && jobResult.getTmpFile() != null) {
        builder.output(FileUtils.readFileToString(jobResult.getTmpFile().toFile()));
        builder.exitCode(jobResult.getExitValue());
        if (jobResult.getExitValue() != 0)
            builder.errors(true);
        if (jobResult.getTmpFile().toFile().delete())
            logger.debug(String.format("%s file deleted", jobResult.getTmpFile().toAbsolutePath()));
    } else {
        builder.output("No output");
        builder.exitCode(-1);
        builder.errors(true);
    }
    if (jobException != null) {
        builder.errors(true);
        builder.errorMessage(jobException.getMessage());
    }
    builder.job(getJob());
    executionStatusRepository.save(builder.build());
}
 
开发者ID:farchanjo,项目名称:webcron,代码行数:34,代码来源:JobListenerImpl.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.getResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。