本文整理汇总了Java中javax.batch.operations.NoSuchJobExecutionException类的典型用法代码示例。如果您正苦于以下问题:Java NoSuchJobExecutionException类的具体用法?Java NoSuchJobExecutionException怎么用?Java NoSuchJobExecutionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoSuchJobExecutionException类属于javax.batch.operations包,在下文中一共展示了NoSuchJobExecutionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restartJobAndWaitForResult
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
public TCKJobExecutionWrapper restartJobAndWaitForResult(long oldExecutionId, Properties restartJobParameters) throws NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, JobSecurityException, JobExecutionTimeoutException {
JobExecution terminatedJobExecution = null;
long newExecutionId = jobOp.restart(oldExecutionId, restartJobParameters);
JobExecutionWaiter waiter = waiterFactory.createWaiter(newExecutionId, jobOp, sleepTime);
try {
terminatedJobExecution = waiter.awaitTermination();
} catch (JobExecutionTimeoutException e) {
logger.severe(TIMEOUT_MSG);
Reporter.log(TIMEOUT_MSG);
throw e;
}
return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp);
}
示例2: stopJobAndWaitForResult
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
public JobExecution stopJobAndWaitForResult(JobExecution jobExecution) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException, JobExecutionTimeoutException {
JobExecution terminatedJobExecution = null;
jobOp.stop(jobExecution.getExecutionId());
JobExecutionWaiter waiter = waiterFactory.createWaiter(jobExecution.getExecutionId(), jobOp, sleepTime);
try {
terminatedJobExecution = waiter.awaitTermination();
} catch (JobExecutionTimeoutException e) {
logger.severe(TIMEOUT_MSG);
Reporter.log(TIMEOUT_MSG);
throw e;
}
return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp);
}
示例3: startJobAndWaitForResult
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
public TCKJobExecutionWrapper startJobAndWaitForResult(String jobName, Properties jobParameters) throws JobStartException, NoSuchJobExecutionException, JobSecurityException, JobExecutionTimeoutException{
JobExecution terminatedJobExecution = null;
long executionId = jobOp.start(jobName, jobParameters);
JobExecutionWaiter waiter = waiterFactory.createWaiter(executionId, jobOp, sleepTime);
try {
terminatedJobExecution = waiter.awaitTermination();
} catch (JobExecutionTimeoutException e) {
logger.severe(TIMEOUT_MSG);
Reporter.log(TIMEOUT_MSG);
throw e;
}
return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp);
}
示例4: getParameters
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public Properties getParameters(long executionId)
throws NoSuchJobExecutionException, JobSecurityException{
Properties props = null;
JobInstance requestedJobInstance = batchKernel.getJobInstance(executionId);
if (isAuthorized(requestedJobInstance.getInstanceId())) {
props = persistenceService.getParameters(executionId);
} else {
logger.warning("getParameters: The current user is not authorized to perform this operation");
throw new JobSecurityException("The current user is not authorized to perform this operation");
}
return props;
}
示例5: getStepExecutions
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public List<StepExecution> getStepExecutions(long executionId)
throws NoSuchJobExecutionException, JobSecurityException {
logger.entering(sourceClass, "getStepExecutions", executionId);
List<StepExecution> stepExecutions = new ArrayList<StepExecution>();
IJobExecution jobEx = batchKernel.getJobExecution(executionId);
if (jobEx == null){
logger.fine("Job Execution: " + executionId + " not found");
throw new NoSuchJobExecutionException("Job Execution: " + executionId + " not found");
}
if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
stepExecutions = persistenceService.getStepExecutionsForJobExecution(executionId);
} else {
logger.warning("getStepExecutions: The current user is not authorized to perform this operation");
throw new JobSecurityException("The current user is not authorized to perform this operation");
}
logger.exiting(sourceClass, "getStepExecutions", stepExecutions);
return stepExecutions;
}
示例6: execute
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public SplitExecutionStatus execute() throws JobRestartException, JobStartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, NoSuchJobExecutionException {
String sourceMethod = "execute";
if (logger.isLoggable(Level.FINER)) {
logger.entering(sourceClass, sourceMethod, "Root JobExecution Id = " + rootJobExecutionId);
}
// Build all sub jobs from partitioned step
buildSubJobBatchWorkUnits();
// kick off the threads
executeWorkUnits();
// Deal with the results.
SplitExecutionStatus status = waitForCompletionAndAggregateStatus();
if (logger.isLoggable(Level.FINER)) {
logger.exiting(sourceClass, sourceMethod, status);
}
return status;
}
示例7: startBatches
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
public void startBatches() throws JobSecurityException, JobStartException, NoSuchJobExecutionException {
JobOperator jobOperator = BatchRuntime.getJobOperator();
logger.log(Level.INFO, "starting simple");
Long executionId = jobOperator.start("simple", new Properties());
JobExecution jobExecution = jobOperator.getJobExecution(executionId);
logger.log(Level.INFO, "Started simple job with id {0}", jobExecution.getExecutionId());
logger.log(Level.INFO, "Status simple {0}", jobExecution.getBatchStatus());
// logger.log(Level.INFO, "starting chunk");
// Long chunkExecutionId = jobOperator.start("chunk", new Properties());
// JobExecution chunkJobExecution = jobOperator.getJobExecution(chunkExecutionId);
//
// logger.log(Level.INFO, "Status chunk {0}", chunkJobExecution.getBatchStatus());
// logger.log(Level.INFO, "Started chunk job with id {0}", chunkJobExecution.getExecutionId());
}
示例8: getParameters
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public Properties getParameters(final long executionId) throws NoSuchJobExecutionException {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
conn = getConnection();
statement = conn.prepareStatement(dictionary.getFindJobExecutionJobProperties());
statement.setLong(1, executionId);
rs = statement.executeQuery();
if (rs.next()) {
final byte[] buf = rs.getBytes(dictionary.jobExecutionColumns(5));
return PropertyHelper.stringToProperties(buf != null ? new String(buf) : null);
}
throw new NoSuchJobExecutionException("Did not find table entry for executionID =" + executionId);
} catch (final SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
}
示例9: getJobInstanceIdByExecutionId
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
public long getJobInstanceIdByExecutionId(final long executionId) throws NoSuchJobExecutionException {
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
conn = getConnection();
statement = conn.prepareStatement(dictionary.getFindJobInstanceFromJobExecution());
statement.setObject(1, executionId);
rs = statement.executeQuery();
if (!rs.next()) {
throw new NoSuchJobExecutionException("Did not find job instance associated with executionID =" + executionId);
}
return rs.getLong(dictionary.jobExecutionColumns(8));
} catch (final SQLException e) {
throw new PersistenceException(e);
} finally {
cleanupConnection(conn, rs, statement);
}
}
示例10: buildOnRestartFlowInSplitWorkUnit
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public BatchFlowInSplitWorkUnit buildOnRestartFlowInSplitWorkUnit(final FlowInSplitBuilderConfig config, final JobContextImpl jc)
throws JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException {
final JSLJob jobModel = config.getJobModel();
final long execId = getMostRecentSubJobExecutionId(jobModel);
final RuntimeFlowInSplitExecution jobExecution;
try {
jobExecution = JobExecutionHelper.restartFlowInSplit(servicesManager, execId, jobModel);
} catch (final NoSuchJobExecutionException e) {
throw new IllegalStateException("Caught NoSuchJobExecutionException but this is an internal JobExecution so this shouldn't have happened: execId =" + execId, e);
}
final BatchFlowInSplitWorkUnit batchWork = new BatchFlowInSplitWorkUnit(jobExecution, config, servicesManager);
jobExecution.inheritJobContext(jc);
registerCurrentInstanceAndExecution(jobExecution, batchWork.getController());
return batchWork;
}
示例11: abandon
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public void abandon(final long executionId) throws NoSuchJobExecutionException, JobExecutionIsRunningException, JobSecurityException {
final InternalJobExecution jobEx = persistenceManagerService.jobOperatorGetJobExecution(executionId);
// if it is not in STARTED or STARTING state, mark it as ABANDONED
BatchStatus status = jobEx.getBatchStatus();
if (status == BatchStatus.STARTING || status == BatchStatus.STARTED) {
throw new JobExecutionIsRunningException("Job Execution: " + executionId + " is still running");
}
// update table to reflect ABANDONED state
persistenceManagerService.updateBatchStatusOnly(jobEx.getExecutionId(), BatchStatus.ABANDONED, new Timestamp(System.currentTimeMillis()));
// Don't forget to update JOBSTATUS table
statusManagerService.updateJobBatchStatus(jobEx.getInstanceId(), BatchStatus.ABANDONED);
}
示例12: getRunningExecutions
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public List<Long> getRunningExecutions(final String jobName) throws NoSuchJobException, JobSecurityException {
final List<Long> jobExecutions = new ArrayList<Long>();
// get the jobexecution ids associated with this job name
final Set<Long> executionIds = persistenceManagerService.jobOperatorGetRunningExecutions(jobName);
if (executionIds.isEmpty()) {
throw new NoSuchJobException("Job Name " + jobName + " not found");
}
// for every job instance id
for (final long id : executionIds) {
try {
if (kernelService.isExecutionRunning(id)) {
final InternalJobExecution jobEx = kernelService.getJobExecution(id);
jobExecutions.add(jobEx.getExecutionId());
}
} catch (final NoSuchJobExecutionException e) {
throw new IllegalStateException("Just found execution with id = " + id + " in table, but now seeing it as gone", e);
}
}
return jobExecutions;
}
示例13: batchMetrics
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
private void batchMetrics(String batchId, HttpServletRequest req, HttpServletResponse resp) {
Long executionId = extractExecutionId(batchId, resp);
if (executionId == null) {
return;
}
try {
JobExecution jobExecution = jobOperator.getJobExecution(executionId);
BatchStatus batchStatus = jobExecution.getBatchStatus();
List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);
reportSuccess(executionId, resp, batchStatus.name());
reportMetricsCsv(resp, stepExecutions);
} catch (NoSuchJobExecutionException noSuchJob) {
reportFailure(executionId, resp, "NoSuchJob");
} catch (Exception generalException) {
StringBuilder msg = new StringBuilder("Failure in BatchExecution");
appendExceptionMsg(msg, generalException);
reportFailure(executionId, resp, msg.toString());
}
}
示例14: batchStop
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
private void batchStop(String batchId, HttpServletRequest req, HttpServletResponse resp) {
Long executionId = extractExecutionId(batchId, resp);
if (executionId == null) {
return;
}
try {
jobOperator.stop(executionId);
reportSuccess(executionId, resp, BatchStatus.STOPPING.toString());
} catch (NoSuchJobExecutionException noSuchJob) {
reportFailure(executionId, resp, "NoSuchJob");
} catch (JobExecutionNotRunningException notRunningException) {
reportFailure(executionId, resp, "JobExecutionNotRunning");
} catch (Exception generalException) {
StringBuilder msg = new StringBuilder("Failure in BatchExecution");
appendExceptionMsg(msg, generalException);
reportFailure(executionId, resp, msg.toString());
}
}
示例15: batchRestart
import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
private void batchRestart(String batchId, HttpServletRequest req, HttpServletResponse resp) {
Long executionId = extractExecutionId(batchId, resp);
if (executionId == null) {
return;
}
Properties jobProperties = extractJobProperties(req, resp);
try {
jobOperator.restart(executionId, jobProperties);
} catch (NoSuchJobExecutionException noSuchJob) {
reportFailure(executionId, resp, "NoSuchJob");
} catch (JobExecutionAlreadyCompleteException alreadyCompleted) {
reportFailure(executionId, resp, "NoSuchJob");
} catch (Exception generalException) {
StringBuilder msg = new StringBuilder("Failure in BatchExecution");
appendExceptionMsg(msg, generalException);
reportFailure(executionId, resp, msg.toString());
}
}