com.hazelcast.jet.Job.resume()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中com.hazelcast.jet.Job.resume()方法的一些代码示例,展示了Job.resume()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.resume()方法的具体详情如下:
包路径:com.hazelcast.jet.Job
类名称:Job
方法名:resume

Job.resume介绍

[英]Resumes a #suspend job. The job will resume from the last known successful snapshot, if there is one.

If the job is not suspended, it does nothing.
[中]恢复暂停工作。作业将从上次已知的成功快照(如果有)恢复。
如果作业未暂停,则不会执行任何操作。

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet-code-samples

job.resume();
waitForStatus(job, JobStatus.RUNNING);

代码示例来源:origin: hazelcast/hazelcast-jet

@Command(
    description = "Resumes a suspended job"
)
public void resume(
    @Parameters(index = "0",
        paramLabel = "<job name or id>",
        description = "Name of the job to resume")
        String name
) throws IOException {
  runWithJet(jet -> {
    Job job = getJob(jet, name);
    if (job.getStatus() != JobStatus.SUSPENDED) {
      throw new RuntimeException("Job '" + name + "' is not suspended. Current state: " + job.getStatus());
    }
    println("Resuming job " + formatJob(job) + "...");
    job.resume();
    waitForJobStatus(job, JobStatus.RUNNING);
    println("Job was successfully resumed.");
  });
}

相关文章