/** * Create a new job instance and shards * @param detail the job detail * @return the new job instance */ private JobInstance createInstanceAndShards(JobDetail detail, JobTriggerType triggerType) { JobInstance instance = new JobInstance(); instance.setJobId(detail.getJob().getId()); instance.setStatus(JobInstanceStatus.RUNNING.value()); instance.setTriggerType(triggerType.value()); instance.setServer(serverHost.get()); instance.setStartTime(new Date()); Response<Boolean> saveResp = jobService.createJobInstanceAndShards(instance, detail.getConfig()); if (!saveResp.isSuccess() || !saveResp.getData()){ throw new JobInstanceCreateException(saveResp.getErr().toString()); } return instance; }