当前位置: 首页>>代码示例>>Java>>正文


Java JobExecution.getBatchStatus方法代码示例

本文整理汇总了Java中javax.batch.runtime.JobExecution.getBatchStatus方法的典型用法代码示例。如果您正苦于以下问题:Java JobExecution.getBatchStatus方法的具体用法?Java JobExecution.getBatchStatus怎么用?Java JobExecution.getBatchStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.batch.runtime.JobExecution的用法示例。


在下文中一共展示了JobExecution.getBatchStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForCompletion

import javax.batch.runtime.JobExecution; //导入方法依赖的package包/类
private void waitForCompletion(final long executionId, final int timeout, final TimeUnit unit) {
    final JobExecution jobExecution = BatchRuntime.getJobOperator().getJobExecution(executionId);
    long time = unit.toMillis(timeout);
    long sleep = 100;
    boolean complete = false;
    while (!complete && time > 0) {
        switch (jobExecution.getBatchStatus()) {
            case STARTED:
            case STARTING:
            case STOPPING:
                try {
                    TimeUnit.MILLISECONDS.sleep(sleep);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                time -= sleep;
                sleep = Math.max(sleep / 2, 100L);
                break;
            default:
                complete = true;
                break;
        }
    }
    Assert.assertTrue("Batch job did not complete withing allotted time.", complete);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:BatchArquillianTest.java

示例2: isTerminated

import javax.batch.runtime.JobExecution; //导入方法依赖的package包/类
private boolean isTerminated(JobExecution jobExecution) {
	boolean retVal = false;
	BatchStatus bs = jobExecution.getBatchStatus();
	if (terminatedStatuses.contains(bs)) {
		logger.fine("Found terminating batch status of: " + jobExecution.getBatchStatus().name());
		if (jobExecution.getExitStatus() != null) {
			logger.fine("Found exit status of: " + jobExecution.getExitStatus());
			retVal = true;
		} else {
			logger.fine("Exit status is still 'null'.  Poll again.");
			retVal = false;
		}
	} else {
		logger.finer("Found non-terminating batch status of: " + jobExecution.getBatchStatus().name());
		retVal = false;
	}
	return retVal;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:19,代码来源:TCKPollingExecutionWaiterFactory.java


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