本文整理汇总了Java中javax.batch.operations.JobOperator.getJobInstances方法的典型用法代码示例。如果您正苦于以下问题:Java JobOperator.getJobInstances方法的具体用法?Java JobOperator.getJobInstances怎么用?Java JobOperator.getJobInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.batch.operations.JobOperator
的用法示例。
在下文中一共展示了JobOperator.getJobInstances方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRun
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Override
public void doRun() {
final JobOperator operator = operator();
final long total = operator.getJobInstanceCount(name);
info(name + " has " + total + " job instances");
info("");
info("instance id");
info("-----------");
final List<JobInstance> id = operator.getJobInstances(name, start, count);
if (id != null) {
for (final JobInstance instance : id) {
info(Long.toString(instance.getInstanceId()));
}
info("-----------");
info("Current/Total: " + (start + id.size()) + "/" + operator.getJobInstanceCount(name));
} else {
info("No instance found.");
}
}
示例2: displayJobDetails
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
private void displayJobDetails(PrintWriter pw) {
pw.println("<table>");
pw.println("<tr><td>Status of Submitted Jobs</td></tr>");
pw.println("<table border=\"yes\">");
pw.println("<tr><td>Job Name</td><td>ExecutionID</td>"
+ "<td>Batch Status</td><td>Exit Status</td>"
+ "<td>Start Time Status</td><td>End Time</td>"
+ "</tr>");
JobOperator jobOperator = BatchRuntime.getJobOperator();
try {
for (JobInstance jobInstance : jobOperator.getJobInstances("payroll", 0, Integer.MAX_VALUE-1)) {
for (JobExecution jobExecution : jobOperator.getJobExecutions(jobInstance)) {
StringBuilder sb = new StringBuilder();
sb.append("<tr>");
sb.append("<td>").append(jobExecution.getJobName()).append("</td>");
sb.append("<td>").append(jobExecution.getExecutionId()).append("</td>");
sb.append("<td>").append(jobExecution.getBatchStatus()).append("</td>");
sb.append("<td>").append(jobExecution.getExitStatus()).append("</td>");
sb.append("<td>").append(jobExecution.getStartTime()).append("</td>");
sb.append("<td>").append(jobExecution.getEndTime()).append("</td>");
pw.println(sb.toString());
}
}
} catch (Exception ex) {
}
pw.println("</table>");
pw.println("</table>");
}
示例3: clearPersistence
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
private static void clearPersistence(final JobOperator jobOperator) {
final PersistenceManagerService service = ServicesManager.find().service(PersistenceManagerService.class);
for (final String name : jobOperator.getJobNames()) {
for (final JobInstance id : jobOperator.getJobInstances(name, 0, Integer.MAX_VALUE)) {
service.cleanUp(id.getInstanceId());
}
}
}
示例4: contextInitialized
import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Override
public void contextInitialized(final ServletContextEvent sce) {
final JobOperator operator = BatchRuntime.getJobOperator();
try { // initialize only once to ensure we can use in tests ids
operator.getJobInstances("init", 0, 10);
} catch (final NoSuchJobException nsje) {
final Properties jobParameters = new Properties();
jobParameters.setProperty("test", "jbatch");
final long id = operator.start("init", jobParameters);
Batches.waitForEnd(operator, id);
}
}