use of com.ibm.jbatch.container.jobinstance.StepExecutionImpl in project Payara by payara.
the class JBatchJDBCPersistenceManager method getStepExecutionByStepExecutionId.
@Override
public StepExecution getStepExecutionByStepExecutionId(long stepExecId) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
long jobexecid = 0;
long stepexecid = 0;
String stepname = null;
String batchstatus = null;
String exitstatus = null;
Exception ex = null;
long readCount = 0;
long writeCount = 0;
long commitCount = 0;
long rollbackCount = 0;
long readSkipCount = 0;
long processSkipCount = 0;
long filterCount = 0;
long writeSkipCount = 0;
Timestamp startTS = null;
Timestamp endTS = null;
StepExecutionImpl stepEx = null;
ObjectInputStream objectIn = null;
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(STEP_EXECUTIONS_BY_STEP_ID));
statement.setLong(1, stepExecId);
rs = statement.executeQuery();
while (rs.next()) {
jobexecid = rs.getLong("jobexecid");
stepexecid = rs.getLong("stepexecid");
stepname = rs.getString("stepname");
batchstatus = rs.getString("batchstatus");
exitstatus = rs.getString("exitstatus");
readCount = rs.getLong("readcount");
writeCount = rs.getLong("writecount");
commitCount = rs.getLong("commitcount");
rollbackCount = rs.getLong("rollbackcount");
readSkipCount = rs.getLong("readskipcount");
processSkipCount = rs.getLong("processskipcount");
filterCount = rs.getLong("filtercount");
writeSkipCount = rs.getLong("writeSkipCount");
startTS = rs.getTimestamp("startTime");
endTS = rs.getTimestamp("endTime");
// get the object based data
Serializable persistentData = null;
byte[] pDataBytes = rs.getBytes("persistentData");
if (pDataBytes != null) {
objectIn = new TCCLObjectInputStream(new ByteArrayInputStream(pDataBytes));
persistentData = (Serializable) objectIn.readObject();
}
stepEx = new StepExecutionImpl(jobexecid, stepexecid);
stepEx.setBatchStatus(BatchStatus.valueOf(batchstatus));
stepEx.setExitStatus(exitstatus);
stepEx.setStepName(stepname);
stepEx.setReadCount(readCount);
stepEx.setWriteCount(writeCount);
stepEx.setCommitCount(commitCount);
stepEx.setRollbackCount(rollbackCount);
stepEx.setReadSkipCount(readSkipCount);
stepEx.setProcessSkipCount(processSkipCount);
stepEx.setFilterCount(filterCount);
stepEx.setWriteSkipCount(writeSkipCount);
stepEx.setStartTime(startTS);
stepEx.setEndTime(endTS);
stepEx.setPersistentUserData(persistentData);
logger.fine("stepExecution BatchStatus: " + batchstatus + " StepName: " + stepname);
}
} 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);
}
return stepEx;
}
Aggregations