Search in sources :

Example 1 with RuntimeJobExecution

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;
}
Also used : RuntimeJobExecution(com.ibm.jbatch.container.jobinstance.RuntimeJobExecution) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PersistenceException(com.ibm.jbatch.container.exception.PersistenceException) PreparedStatement(java.sql.PreparedStatement) StepStatus(com.ibm.jbatch.container.status.StepStatus) IOException(java.io.IOException)

Example 2 with RuntimeJobExecution

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;
}
Also used : JobStatus(com.ibm.jbatch.container.status.JobStatus) RuntimeJobExecution(com.ibm.jbatch.container.jobinstance.RuntimeJobExecution) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PersistenceException(com.ibm.jbatch.container.exception.PersistenceException) PreparedStatement(java.sql.PreparedStatement) IOException(java.io.IOException)

Example 3 with RuntimeJobExecution

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;
}
Also used : RuntimeJobExecution(com.ibm.jbatch.container.jobinstance.RuntimeJobExecution) Timestamp(java.sql.Timestamp) RequestTraceSpanLog(fish.payara.notification.requesttracing.RequestTraceSpanLog)

Aggregations

RuntimeJobExecution (com.ibm.jbatch.container.jobinstance.RuntimeJobExecution)3 PersistenceException (com.ibm.jbatch.container.exception.PersistenceException)2 IOException (java.io.IOException)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 JobStatus (com.ibm.jbatch.container.status.JobStatus)1 StepStatus (com.ibm.jbatch.container.status.StepStatus)1 RequestTraceSpanLog (fish.payara.notification.requesttracing.RequestTraceSpanLog)1 Timestamp (java.sql.Timestamp)1