use of com.ibm.jbatch.container.jobinstance.RuntimeJobExecution in project Payara by payara.
the class JBatchJDBCPersistenceManager method getStepStatus.
/*
* (non-Javadoc)
*
* @see
* com.ibm.jbatch.container.services.IPersistenceManagerService#getStepStatus
* (long, java.lang.String)
*/
@Override
public StepStatus getStepStatus(long instanceId, String stepName) {
logger.entering(CLASSNAME, "getStepStatus", new Object[] { instanceId, stepName });
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
RuntimeJobExecution jobExecution = null;
String query = queryStrings.get(GET_STEP_STATUS);
StepStatus stepStatus = null;
try {
conn = getConnection();
statement = conn.prepareStatement(query);
statement.setLong(1, instanceId);
statement.setString(2, stepName);
rs = statement.executeQuery();
if (rs.next()) {
stepStatus = (StepStatus) deserializeObject(rs.getBytes(1));
}
} catch (SQLException e) {
throw new PersistenceException(e);
} catch (IOException e) {
throw new PersistenceException(e);
} catch (ClassNotFoundException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
logger.exiting(CLASSNAME, "getStepStatus", stepStatus == null ? "<null>" : stepStatus);
return stepStatus;
}
use of com.ibm.jbatch.container.jobinstance.RuntimeJobExecution in project Payara by payara.
the class JBatchJDBCPersistenceManager method getJobStatus.
/*
* (non-Javadoc)
*
* @see
* com.ibm.jbatch.container.services.IPersistenceManagerService#getJobStatus
* (long)
*/
@Override
public JobStatus getJobStatus(long instanceId) {
logger.entering(CLASSNAME, "getJobStatus", instanceId);
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
RuntimeJobExecution jobExecution = null;
String query = queryStrings.get(GET_JOB_STATUS);
JobStatus jobStatus = null;
try {
conn = getConnection();
statement = conn.prepareStatement(query);
statement.setLong(1, instanceId);
rs = statement.executeQuery();
if (rs.next()) {
jobStatus = (JobStatus) deserializeObject(rs.getBytes(1));
}
} catch (SQLException e) {
throw new PersistenceException(e);
} catch (IOException e) {
throw new PersistenceException(e);
} catch (ClassNotFoundException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
logger.exiting(CLASSNAME, "getJobStatus", jobStatus);
return jobStatus;
}
use of com.ibm.jbatch.container.jobinstance.RuntimeJobExecution in project Payara by payara.
the class JBatchJDBCPersistenceManager method createJobExecution.
/*
* (non-Javadoc)
*
* @see com.ibm.jbatch.container.services.IPersistenceManagerService#
* createJobExecution(com.ibm.jbatch.container.jsl.JobNavigator,
* javax.batch.runtime.JobInstance, java.util.Properties,
* com.ibm.jbatch.container.context.impl.JobContextImpl)
*/
@Override
public RuntimeJobExecution createJobExecution(JobInstance jobInstance, Properties jobParameters, BatchStatus batchStatus) {
Timestamp now = new Timestamp(System.currentTimeMillis());
long newExecutionId = createRuntimeJobExecutionEntry(jobInstance, jobParameters, batchStatus, now);
RuntimeJobExecution jobExecution = new RuntimeJobExecution(jobInstance, newExecutionId);
jobExecution.setBatchStatus(batchStatus.name());
jobExecution.setCreateTime(now);
jobExecution.setLastUpdateTime(now);
if (requestTracing != null && requestTracing.isRequestTracingEnabled() && requestTracing.isTraceInProgress()) {
RequestTraceSpanLog spanLog = constructJBatchExecutionSpanLog(jobExecution);
requestTracing.addSpanLog(spanLog);
}
return jobExecution;
}
Aggregations