Package org.jberet.runtime

Examples of org.jberet.runtime.JobExecutionImpl


        super(step.getId(), outerContexts);
        this.step = step;
        this.classLoader = getJobContext().getClassLoader();
        this.stepExecution = getJobContext().jobRepository.createStepExecution(id);

        final JobExecutionImpl originalToRestart = getJobContext().originalToRestart;
        if (originalToRestart != null) {  //currently in a restarted execution
            originalStepExecution = getJobContext().getJobRepository().findOriginalStepExecutionForRestart(id, originalToRestart);
            if (originalStepExecution != null) {
                if (originalStepExecution.getBatchStatus() == BatchStatus.COMPLETED) {
                    allowStartIfComplete = Boolean.valueOf(step.getAllowStartIfComplete());
View Full Code Here


        }
    }

    @Override
    public JobExecution getJobExecution(final long jobExecutionId) {
        JobExecutionImpl result = (JobExecutionImpl) super.getJobExecution(jobExecutionId);
        if (result != null) {
            return result;
        }
        final String select = sqls.getProperty(SELECT_JOB_EXECUTION);
        final Connection connection = getConnection();
        PreparedStatement preparedStatement = null;
        try {
            preparedStatement = connection.prepareStatement(select);
            preparedStatement.setLong(1, jobExecutionId);
            final ResultSet rs = preparedStatement.executeQuery();
            while (rs.next()) {
                result = (JobExecutionImpl) jobExecutions.get(jobExecutionId);
                if(result == null) {
                    final long jobInstanceId = rs.getLong(TableColumn.JOBINSTANCEID);
                    result = new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId), null);
                    result.setId(jobExecutionId);
                    jobExecutions.put(jobExecutionId, result);
                }
                break;
            }
        } catch (Exception e) {
View Full Code Here

                    if (jobInstanceId == 0) {
                        jobInstanceId = rs.getLong(TableColumn.JOBINSTANCEID);
                    }
                    final Properties jobParameters1 = BatchUtil.stringToProperties(rs.getString(TableColumn.JOBPARAMETERS));
                    jobExecution1 =
                            new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId), i, jobParameters1,
                                    rs.getTimestamp(TableColumn.CREATETIME), rs.getTimestamp(TableColumn.STARTTIME),
                                    rs.getTimestamp(TableColumn.ENDTIME), rs.getTimestamp(TableColumn.LASTUPDATEDTIME),
                                    rs.getString(TableColumn.BATCHSTATUS), rs.getString(TableColumn.EXITSTATUS),
                                    rs.getString(TableColumn.RESTARTPOSITION));
View Full Code Here

            final ResultSet rs = preparedStatement.executeQuery();
            while (rs.next()) {
                result = jobExecutions.get(jobExecutionId);
                if (result == null) {
                    final long jobInstanceId = rs.getLong(TableColumn.JOBINSTANCEID);
                    result = new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId), null);
                    jobExecutions.put(jobExecutionId, result);
                }
                break;
            }
        } catch (SQLException e) {
View Full Code Here

                final long i = rs.getLong(TableColumn.JOBEXECUTIONID);
                JobExecution jobExecution1 = jobExecutions.get(i);
                if (jobExecution1 == null) {
                    if (jobInstanceId == null) {
                        final long jobInstanceId1 = rs.getLong(TableColumn.JOBINSTANCEID);
                        jobExecution1 = new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId1), null);
                    } else {
                        jobExecution1 = new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId), null);
                    }
                    jobExecutions.put(i, jobExecution1);
                }
                //this job instance is already in the cache, so get it from the cache
                result.add(jobExecution1);
View Full Code Here

        return count;
    }

    @Override
    public JobExecutionImpl createJobExecution(final JobInstanceImpl jobInstance, final Properties jobParameters) {
        final JobExecutionImpl jobExecution = new JobExecutionImpl(jobInstance, jobParameters);
        insertJobExecution(jobExecution);
        final JobExecution jobExecutionExisting = jobExecutions.putIfAbsent(jobExecution.getExecutionId(), jobExecution);
        if (jobExecutionExisting != null) {
            throw BatchLogger.LOGGER.jobExecutionAlreadyExists(jobExecutionExisting.getExecutionId());
        }
        jobInstance.addJobExecution(jobExecution);
        return jobExecution;
View Full Code Here

        return jobExecutions.values();
    }

    @Override
    public List<StepExecution> getStepExecutions(final long jobExecutionId) {
        final JobExecutionImpl jobExecution = (JobExecutionImpl) getJobExecution(jobExecutionId);
        return jobExecution.getStepExecutions();
    }
View Full Code Here

        }
    }

    @Override
    public JobExecution getJobExecution(final long jobExecutionId) {
        JobExecutionImpl result = (JobExecutionImpl) super.getJobExecution(jobExecutionId);
        if (result != null) {
            return result;
        }
        final String select = sqls.getProperty(SELECT_JOB_EXECUTION);
        final Connection connection = getConnection();
        ResultSet rs = null;
        PreparedStatement preparedStatement = null;
        try {
            preparedStatement = connection.prepareStatement(select);
            preparedStatement.setLong(1, jobExecutionId);
            rs = preparedStatement.executeQuery();
            while (rs.next()) {
                result = (JobExecutionImpl) jobExecutions.get(jobExecutionId);
                if (result == null) {
                    final long jobInstanceId = rs.getLong(TableColumns.JOBINSTANCEID);
                    result = new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId),
                            jobExecutionId,
                            BatchUtil.stringToProperties(rs.getString(TableColumns.JOBPARAMETERS)),
                            rs.getTimestamp(TableColumns.CREATETIME),
                            rs.getTimestamp(TableColumns.STARTTIME),
                            rs.getTimestamp(TableColumns.ENDTIME),
View Full Code Here

                    if (jobInstanceId == 0) {
                        jobInstanceId = rs.getLong(TableColumns.JOBINSTANCEID);
                    }
                    final Properties jobParameters1 = BatchUtil.stringToProperties(rs.getString(TableColumns.JOBPARAMETERS));
                    jobExecution1 =
                            new JobExecutionImpl((JobInstanceImpl) getJobInstance(jobInstanceId), i, jobParameters1,
                                    rs.getTimestamp(TableColumns.CREATETIME), rs.getTimestamp(TableColumns.STARTTIME),
                                    rs.getTimestamp(TableColumns.ENDTIME), rs.getTimestamp(TableColumns.LASTUPDATEDTIME),
                                    rs.getString(TableColumns.BATCHSTATUS), rs.getString(TableColumns.EXITSTATUS),
                                    rs.getString(TableColumns.RESTARTPOSITION));
View Full Code Here

    }

    @Override
    public void stop(final long executionId) throws NoSuchJobExecutionException,
            JobExecutionNotRunningException, JobSecurityException {
        final JobExecutionImpl jobExecution = (JobExecutionImpl) repository.getJobExecution(executionId);
        if (jobExecution == null) {
            throw MESSAGES.noSuchJobExecution(executionId);
        }
        final BatchStatus s = jobExecution.getBatchStatus();
        if (s == BatchStatus.STOPPED || s == BatchStatus.FAILED || s == BatchStatus.ABANDONED ||
                s == BatchStatus.COMPLETED) {
            throw MESSAGES.jobExecutionNotRunningException(executionId, s);
        } else if (s == BatchStatus.STOPPING) {
            //in process of stopping, do nothing
        } else {
            jobExecution.setBatchStatus(BatchStatus.STOPPING);
            jobExecution.stop();
        }
    }
View Full Code Here

TOP

Related Classes of org.jberet.runtime.JobExecutionImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.