use of com.ibm.jbatch.container.status.StepStatus in project Payara by payara.
the class JBatchJDBCPersistenceManager method createStepStatus.
/*
* (non-Javadoc)
*
* @see
* com.ibm.jbatch.container.services.IPersistenceManagerService#createStepStatus
* (long)
*/
@Override
public StepStatus createStepStatus(long stepExecId) {
logger.entering(CLASSNAME, "createStepStatus", stepExecId);
Connection conn = null;
PreparedStatement statement = null;
StepStatus stepStatus = new StepStatus(stepExecId);
try {
conn = getConnection();
statement = conn.prepareStatement(queryStrings.get(CREATE_STEP_STATUS));
statement.setLong(1, stepExecId);
statement.setBytes(2, serializeObject(stepStatus));
statement.executeUpdate();
} catch (SQLException e) {
throw new PersistenceException(e);
} catch (IOException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, null, statement);
}
logger.exiting(CLASSNAME, "createStepStatus");
return stepStatus;
}
use of com.ibm.jbatch.container.status.StepStatus 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;
}
Aggregations