public class MyJobState implements JobState { private String status; public MyJobState(String status) { this.status = status; } @Override public String toStringValue() { return status; } public void setStatus(String status) { this.status = status; } } public class MyJob implements Runnable { @Override public void run() { MyJobState jobState = (MyJobState) BackgroundJob.getCurrentJob() .getJobState(); } } Job job = BackgroundJob.getJobById(jobId); JobState jobState = job.getJobState(); if (jobState instanceof MyJobState) { MyJobState myJobState = (MyJobState) jobState; } <dependency> <groupId>org.jobrunr</groupId> <artifactId>jobrunr</artifactId> <version>3.x.x</version> </dependency>


上一篇:
下一篇:
切换中文