• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NoSuchJobExecutionException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.batch.operations.NoSuchJobExecutionException的典型用法代码示例。如果您正苦于以下问题:Java NoSuchJobExecutionException类的具体用法?Java NoSuchJobExecutionException怎么用?Java NoSuchJobExecutionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NoSuchJobExecutionException类属于javax.batch.operations包,在下文中一共展示了NoSuchJobExecutionException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:18,代码来源:JobOperatorBridge.java


示例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);
}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:18,代码来源:JobOperatorBridge.java


示例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);
}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:17,代码来源:JobOperatorBridge.java


示例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;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:17,代码来源:JobOperatorImpl.java


示例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;

}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:25,代码来源:JobOperatorImpl.java


示例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;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:23,代码来源:SplitControllerImpl.java


示例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());
   }
 
开发者ID:ivargrimstad,项目名称:javaee-batch,代码行数:18,代码来源:SimpleBatchStarter.java


示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:24,代码来源:JDBCPersistenceManagerService.java


示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:21,代码来源:JDBCPersistenceManagerService.java


示例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;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:19,代码来源:DefaultBatchKernel.java


示例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);
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:JobOperatorImpl.java


示例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;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:25,代码来源:JobOperatorImpl.java


示例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());
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:22,代码来源:SimpleRestController.java


示例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());
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:20,代码来源:SimpleRestController.java


示例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());
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:21,代码来源:SimpleRestController.java


示例16: restart

import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public long restart(String jobName, Integer executionId)
        throws BatchException {
    Properties restartParameters = getJobParameters(jobName);
    try {
        return jsrJobOperator.restart(executionId, restartParameters);
    } catch (NoSuchJobExecutionException e) {
        throw new BatchException(ApplicationErrors.BAD_REQUEST, e,
                e.getMessage());
    }

}
 
开发者ID:motech,项目名称:modules,代码行数:13,代码来源:JobTriggerServiceImpl.java


示例17: abandon

import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public void abandon(long executionId)
		throws NoSuchJobExecutionException, JobExecutionIsRunningException, JobSecurityException {

	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		IJobExecution jobEx = persistenceService.jobOperatorGetJobExecution(executionId);

		// if it is not in STARTED or STARTING state, mark it as ABANDONED
		List<BatchStatus> runningStatusesList = Arrays.asList(new BatchStatus[] {BatchStatus.STARTED, BatchStatus.STARTING});
		Set<BatchStatus> runningStatusesSet = Collections.unmodifiableSet(new HashSet<BatchStatus>(runningStatusesList));

		if (!runningStatusesSet.contains(jobEx.getBatchStatus())) {
			// update table to reflect ABANDONED state
			long time = System.currentTimeMillis();
			Timestamp timestamp = new Timestamp(time);
			persistenceService.updateBatchStatusOnly(jobEx.getExecutionId(), BatchStatus.ABANDONED, timestamp);
			logger.fine("Job Execution: " + executionId + " was abandoned");

			// Don't forget to update JOBSTATUS table
			_jobStatusManagerService.updateJobBatchStatus(jobEx.getInstanceId(), BatchStatus.ABANDONED);
		}
		else {
			logger.warning("Job Execution: " + executionId + " is still running");
			throw new JobExecutionIsRunningException("Job Execution: " + executionId + " is still running");
		}
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}

}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:31,代码来源:JobOperatorImpl.java


示例18: getJobExecution

import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public IJobExecution getJobExecution(long executionId)
		throws NoSuchJobExecutionException, JobSecurityException {
	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		return batchKernel.getJobExecution(executionId);
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:10,代码来源:JobOperatorImpl.java


示例19: getJobInstance

import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public JobInstance getJobInstance(long executionId)
		throws NoSuchJobExecutionException, JobSecurityException {
	if (isAuthorized(persistenceService.getJobInstanceIdByExecutionId(executionId))) {
		return this.batchKernel.getJobInstance(executionId);
	} else {
		throw new JobSecurityException("The current user is not authorized to perform this operation");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:10,代码来源:JobOperatorImpl.java


示例20: getRunningExecutions

import javax.batch.operations.NoSuchJobExecutionException; //导入依赖的package包/类
@Override
public List<Long> getRunningExecutions(String jobName)
		throws NoSuchJobException, JobSecurityException {

	logger.entering(sourceClass, "getRunningExecutions", jobName);
	List<Long> jobExecutions = new ArrayList<Long>();

	// get the jobexecution ids associated with this job name
	Set<Long> executionIds = persistenceService.jobOperatorGetRunningExecutions(jobName);

	if (executionIds.size() > 0){
		// for every job instance id
		for (long id : executionIds){
			try {
				logger.finer("Examining executionId: " + id);
				if(isAuthorized(persistenceService.getJobInstanceIdByExecutionId(id))) {
					if (batchKernel.isExecutionRunning(id)) {
						IJobExecution jobEx = batchKernel.getJobExecution(id);
						jobExecutions.add(jobEx.getExecutionId());
					} else {
						logger.finer("Found executionId: " + id + " with a BatchStatus indicating running, but kernel doesn't currently have an entry for this execution in the kernel's in-memory map.");
					}
				} else {
					logger.finer("Don't have authorization for executionId: " + id);
				}
			} catch (NoSuchJobExecutionException e) {
				String errorMsg = "Just found execution with id = " + id + " in table, but now seeing it as gone";
				logger.severe(errorMsg);
				throw new IllegalStateException(errorMsg, e);
			}
		}
		// send the list of objs back to caller
		logger.exiting(sourceClass, "getRunningExecutions", jobExecutions);
		return jobExecutions;
	}
	else { 
		logger.fine("getRunningExecutions: Job Name " + jobName + " not found");
		throw new NoSuchJobException( "Job Name " + jobName + " not found");
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:41,代码来源:JobOperatorImpl.java



注:本文中的javax.batch.operations.NoSuchJobExecutionException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Callback类代码示例发布时间:2022-05-22
下一篇:
Java AwarenessServiceEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap