@Override public List<JobExecution> getJobExecutions(JobInstance jobInstance) throws NoSuchJobInstanceException, JobSecurityException { if(jobInstance == null) { throw new NoSuchJobInstanceException("A null JobInstance was provided"); } org.springframework.batch.core.JobInstance instance = (org.springframework.batch.core.JobInstance) jobInstance; List<org.springframework.batch.core.JobExecution> batchExecutions = jobExplorer.getJobExecutions(instance); if(batchExecutions == null || batchExecutions.size() == 0) { throw new NoSuchJobInstanceException("Unable to find JobInstance " + jobInstance.getInstanceId()); } List<JobExecution> results = new ArrayList<>(batchExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : batchExecutions) { results.add(new JsrJobExecution(jobExecution, jobParametersConverter)); } return results; }
@Override public final NoSuchJobInstanceException noSuchJobInstance(final String jobInstanceValue) { final NoSuchJobInstanceException result = new NoSuchJobInstanceException(String.format(getLoggingLocale(), noSuchJobInstance$str(), jobInstanceValue)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unrestartableJob = "JBERET000646: Failed to restart the job with name: %s, execution id: %s, because the job is configured not restartable";
@Override public JobInstanceEntity getJobInstance(long jobInstanceId) throws NoSuchJobInstanceException { final JobInstanceEntity jobInstance = data.jobInstanceData.get(jobInstanceId); if (jobInstance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } return jobInstance; }
@Override public Void call() { final JobInstanceEntity instance; instance = em.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } entityMgr.remove(instance); return null; } }.runInNewOrExistingGlobalTran();
@Override public JobInstance call() { JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } instance.setRestartOn(restartOn); return instance; } }.runInNewOrExistingGlobalTran();
@Override public JobInstanceEntityV3 call() { JobInstanceEntityV3 instance = entityMgr.find(JobInstanceEntityV3.class, jobInstanceID); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceID); } instance.setGroupNames(groupNames); entityMgr.merge(instance); return instance; } }.runInNewOrExistingGlobalTran();
@Override public JobInstance call() { JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } instance.setRestartOn(null); return instance; } }.runInNewOrExistingGlobalTran();
@Override public JobInstance call() { JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } instance.setJobName(jobName); instance.setJobXml(jobXml); return instance; } }.runInNewOrExistingGlobalTran();
@Override public List<JobExecution> getJobExecutions(JobInstance jobInstance) throws NoSuchJobInstanceException, JobSecurityException { if(jobInstance == null) { throw new NoSuchJobInstanceException("A null JobInstance was provided"); } org.springframework.batch.core.JobInstance instance = (org.springframework.batch.core.JobInstance) jobInstance; List<org.springframework.batch.core.JobExecution> batchExecutions = jobExplorer.getJobExecutions(instance); if(batchExecutions == null || batchExecutions.size() == 0) { throw new NoSuchJobInstanceException("Unable to find JobInstance " + jobInstance.getInstanceId()); } List<JobExecution> results = new ArrayList<JobExecution>(batchExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : batchExecutions) { results.add(new JsrJobExecution(jobExecution, jobParametersConverter)); } return results; }
@Override public List<JobExecution> getJobExecutions(JobInstance jobInstance) throws NoSuchJobInstanceException, JobSecurityException { if(jobInstance == null) { throw new NoSuchJobInstanceException("A null JobInstance was provided"); } org.springframework.batch.core.JobInstance instance = (org.springframework.batch.core.JobInstance) jobInstance; List<org.springframework.batch.core.JobExecution> batchExecutions = jobExplorer.getJobExecutions(instance); if(batchExecutions == null || batchExecutions.size() == 0) { throw new NoSuchJobInstanceException("Unable to find JobInstance " + jobInstance.getInstanceId()); } List<JobExecution> results = new ArrayList<JobExecution>(batchExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : batchExecutions) { results.add(new JsrJobExecution(jobExecution, jobParametersConverter)); } return results; }
@Override public List<JobExecution> getJobExecutions(JobInstance jobInstance) throws NoSuchJobInstanceException, JobSecurityException { if(jobInstance == null) { throw new NoSuchJobInstanceException("A null JobInstance was provided"); } org.springframework.batch.core.JobInstance instance = (org.springframework.batch.core.JobInstance) jobInstance; List<org.springframework.batch.core.JobExecution> batchExecutions = jobExplorer.getJobExecutions(instance); if(batchExecutions == null || batchExecutions.size() == 0) { throw new NoSuchJobInstanceException("Unable to find JobInstance " + jobInstance.getInstanceId()); } List<JobExecution> results = new ArrayList<JobExecution>(batchExecutions.size()); for (org.springframework.batch.core.JobExecution jobExecution : batchExecutions) { results.add(new JsrJobExecution(jobExecution, jobParametersConverter)); } return results; }
@Override public List<JobExecution> getJobExecutions(final JobInstance instance) throws NoSuchJobInstanceException, JobSecurityException { // Mediate between one final List<JobExecution> executions = new ArrayList<JobExecution>(); List<InternalJobExecution> executionImpls = persistenceManagerService.jobOperatorGetJobExecutions(instance.getInstanceId()); if (executionImpls.size() == 0) { throw new NoSuchJobInstanceException("Job: " + instance.getJobName() + " does not exist"); } for (InternalJobExecution e : executionImpls) { executions.add(e); } return executions; }
@Override public JobInstanceEntity call() { JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId);/* , LockModeType.PESSIMISTIC_WRITE); */ if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } try { verifyStateTransitionIsValid(instance, InstanceState.JMS_CONSUMED); } catch (BatchIllegalJobStatusTransitionException e) { throw new PersistenceException(e); } Query jpaQuery = entityMgr.createQuery(FINAL_UPDATE); jpaQuery.setParameter("instanceId", jobInstanceId); if (instanceVersion >= 2) jpaQuery.setParameter("lastUpdatedTime", new Date()); int count = jpaQuery.executeUpdate(); if (count > 0) { logger.finer("Match on updateJobInstanceStateOnConsumed query for instance = " + jobInstanceId); // Need to refresh to pick up changes made to the database entityMgr.refresh(instance); } else { logger.finer("No match on updateJobInstanceStateOnConsumed query for instance = " + jobInstanceId); } return instance; } }.runInNewOrExistingGlobalTran();
String msg = "Did not find sub job instance named = " + zerothPartitionSubJobName; logger.fine(msg); throw new NoSuchJobInstanceException(msg);
@Override public JobInstanceEntity call() { JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } try { verifyStateTransitionIsValid(instance, InstanceState.JMS_QUEUED); } catch (BatchIllegalJobStatusTransitionException e) { throw new PersistenceException(e); } Query jpaQuery = entityMgr.createQuery(FINAL_UPDATE); jpaQuery.setParameter("instanceId", jobInstanceId); if (instanceVersion >= 2) jpaQuery.setParameter("lastUpdatedTime", new Date()); int count = jpaQuery.executeUpdate(); if (count > 0) { logger.finer("Match on updateJobInstanceStateOnQueued query for instance = " + jobInstanceId); // Need to refresh to pick up changes made to the database entityMgr.refresh(instance); } else { logger.finer("No match on updateJobInstanceStateOnQueued query for instance = " + jobInstanceId); } return instance; } }.runInNewOrExistingGlobalTran();
JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId);
JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId);/* , LockModeType.PESSIMISTIC_WRITE); */ if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId);
JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId);
@Override public JobInstance updateJobInstanceWithRestartOn(final long jobInstanceId, final String restartOn) { EntityManager em = getPsu().createEntityManager(); try { return new TranRequest<JobInstance>(em) { @Override public JobInstance call() { JobInstanceEntity instance = entityMgr.find(JobInstanceEntity.class, jobInstanceId); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceId); } instance.setRestartOn(restartOn); return instance; } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
@Override public JobInstanceEntity updateJobInstanceWithGroupNames(final long jobInstanceID, final Set<String> groupNames) { EntityManager em = getPsu().createEntityManager(); try { return new TranRequest<JobInstanceEntityV3>(em) { @Override public JobInstanceEntityV3 call() { JobInstanceEntityV3 instance = entityMgr.find(JobInstanceEntityV3.class, jobInstanceID); if (instance == null) { throw new NoSuchJobInstanceException("No job instance found for id = " + jobInstanceID); } instance.setGroupNames(groupNames); entityMgr.merge(instance); return instance; } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }