• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java NoSuchJobException类的典型用法和代码示例

java 2次浏览

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

NoSuchJobException类属于javax.batch.operations包,在下文中一共展示了NoSuchJobException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: restartJobAndWaitForResult

点赞 3

import javax.batch.operations.NoSuchJobException; //导入依赖的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: getJobInstanceCount

点赞 3

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException {

	int jobInstanceCount = 0;

	BatchSecurityHelper helper = getBatchSecurityHelper();
	
	if (isCurrentTagAdmin(helper)) {
		// Do an unfiltered query
		jobInstanceCount = persistenceService.jobOperatorGetJobInstanceCount(jobName);
	} else {
		jobInstanceCount = persistenceService.jobOperatorGetJobInstanceCount(jobName, helper.getCurrentTag());
	}

	if (jobInstanceCount > 0) {
		return jobInstanceCount;
	}
	else { 
		logger.fine("getJobInstanceCount: Job Name " + jobName + " not found");
		throw new NoSuchJobException( "Job " + jobName + " not found");
	}
}
 

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

示例3: getRunningExecutions

点赞 3

import javax.batch.operations.NoSuchJobException; //导入依赖的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

示例4: doRun

点赞 3

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public void doRun() {
    final JobOperator operator = operator();
    final Set<String> names = operator.getJobNames();
    if (names == null || names.isEmpty()) {
        info("No job");
    } else {
        info("     Name   \t|\texecution id\t|\tbatch status\t|\texit status\t|\tstart time\t|\tend time");
        for (final String name : names) {
            try {
                final JobExecution exec = new LinkedList<JobExecution>(
                        operator.getJobExecutions(
                            new LinkedList<JobInstance>(
                                operator.getJobInstances(name, operator.getJobInstanceCount(name) - 1, 2)).getLast())).getLast();
                info(String.format("%s\t|\t%12d\t|\t%s\t|\t%s\t|\t%tc\t|\t%tc",
                        StringUtils.leftPad(name, 12),
                        exec.getExecutionId(),
                        StringUtils.leftPad(exec.getBatchStatus() != null ? exec.getBatchStatus().toString() : "null", 12),
                        StringUtils.leftPad(exec.getExitStatus(), 11), exec.getStartTime(), exec.getEndTime()));
            } catch (final NoSuchJobException nsje) {
                // no-op
            }
        }
    }
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:26,
代码来源:Status.java

示例5: getJobExecutionHistory

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public JobExecutionHistoryListDTO getJobExecutionHistory(String jobName)
        throws BatchException {
    List<JobExecution> jobExecutions = new ArrayList<>();
    BatchJob batchJob = jobRepo.findByJobName(jobName);
    if (batchJob == null) {
        throw new BatchException(ApplicationErrors.JOB_NOT_FOUND);
    }

    int count;

    try {
        count = jsrJobOperator.getJobInstanceCount(jobName);
    } catch (NoSuchJobException nsje) {
        throw new BatchException(ApplicationErrors.JOB_NOT_FOUND, nsje);
    }
    List<JobInstance> jobInstances = jsrJobOperator.getJobInstances(
            jobName, 0, count);

    for (JobInstance jobInstance : jobInstances) {
        jobExecutions.addAll(jsrJobOperator.getJobExecutions(jobInstance));
    }

    JobExecutionHistoryListDTO historyListDTO = new JobExecutionHistoryListDTO();
    historyListDTO.setJobExecutionHistoryList(jobExecutions);

    return historyListDTO;

}
 

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

示例6: getRunningExecutions

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的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

示例7: getRunningExecutions

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public Long[] getRunningExecutions(final String jobName) {
    try {
        final List<Long> runningExecutions = operator.getRunningExecutions(jobName);
        return runningExecutions.toArray(new Long[runningExecutions.size()]);
    } catch (final NoSuchJobException nsje) {
        return new Long[0];
    }
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:10,
代码来源:BatchEEMBeanImpl.java

示例8: getJobInstanceCount

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException {
    final int jobInstanceCount = persistenceManagerService.jobOperatorGetJobInstanceCount(jobName);
    if (jobInstanceCount > 0) {
        return jobInstanceCount;
    }
    throw new NoSuchJobException("Job " + jobName + " not found");
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:9,
代码来源:JobOperatorImpl.java

示例9: getJobInstances

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public List<JobInstance> getJobInstances(String jobName, int start,
                                         int count) throws NoSuchJobException, JobSecurityException {

    List<JobInstance> jobInstances = new ArrayList<JobInstance>();

    if (count == 0) {
        return new ArrayList<JobInstance>();
    } else if (count < 0) {
        throw new IllegalArgumentException("Count should be a positive integer (or 0, which will return an empty list)");
    }

    final List<Long> instanceIds = persistenceManagerService.jobOperatorGetJobInstanceIds(jobName, start, count);

    // get the jobinstance ids associated with this job name

    if (instanceIds.size() > 0) {
        // for every job instance id
        for (long id : instanceIds) {
            // get the job instance obj, add it to the list
            final JobStatus jobStatus = statusManagerService.getJobStatus(id);
            final JobInstance jobInstance = jobStatus.getJobInstance();
            jobInstances.add(jobInstance);
        }
        // send the list of objs back to caller
        return jobInstances;
    }

    throw new NoSuchJobException("Job Name " + jobName + " not found");
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:31,
代码来源:JobOperatorImpl.java

示例10: contextInitialized

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的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);
    }
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:14,
代码来源:CreateSomeJobs.java

示例11: getLastStepExecutions

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
public List<StepExecution> getLastStepExecutions() {
    final int jobInstanceCount = SYNCHRONOUS_JOB_OPERATOR.getJobInstanceCount(name);
    List<JobInstance> instance;
    try {
        instance = SYNCHRONOUS_JOB_OPERATOR.getJobInstances(name, jobInstanceCount, 1);
    } catch (final NoSuchJobException nsje) { // can depend how are indexed the job ids
        instance = SYNCHRONOUS_JOB_OPERATOR.getJobInstances(name, jobInstanceCount - 1, 1);
    }
    return SYNCHRONOUS_JOB_OPERATOR.getStepExecutions(instance.iterator().next().getInstanceId());
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:11,
代码来源:JobLauncher.java

示例12: getJobInstanceCount

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException {
	return jobOp.getJobInstanceCount(jobName);
}
 

开发者ID:WASdev,
项目名称:standards.jsr352.tck,
代码行数:4,
代码来源:JobOperatorBridge.java

示例13: getRunningExecutions

点赞 2

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

开发者ID:WASdev,
项目名称:standards.jsr352.tck,
代码行数:4,
代码来源:JobOperatorBridge.java

示例14: restartJobWithoutWaitingForResult

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
public TCKJobExecutionWrapper restartJobWithoutWaitingForResult(long oldExecutionId, Properties jobParameters) throws NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, JobSecurityException, JobExecutionTimeoutException {
	Long execID = (Long)jobOp.restart(oldExecutionId, jobParameters);
	JobExecution jobExecution = jobOp.getJobExecution(execID);
	return new TCKJobExecutionWrapper(jobExecution, jobOp);
}
 

开发者ID:WASdev,
项目名称:standards.jsr352.tck,
代码行数:6,
代码来源:JobOperatorBridge.java

示例15: getJobInstances

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
public List<JobInstance> getJobInstances(String jobName, int start, int end) throws NoSuchJobException, JobSecurityException {
	return jobOp.getJobInstances(jobName, start, end);
}
 

开发者ID:WASdev,
项目名称:standards.jsr352.tck,
代码行数:4,
代码来源:JobOperatorBridge.java

示例16: testJobOpgetJobInstancesException

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Test  
@org.junit.Test
public void testJobOpgetJobInstancesException() throws Exception {
	String METHOD = "testJobOpgetJobInstancesException";
	begin(METHOD);

	try {

		Reporter.log("Create job parameters for execution #1:<p>");
		Properties jobParams = new Properties();
		Reporter.log("execution.number=1<p>");
		Reporter.log("readrecord.faile=12<p>");
		Reporter.log("app.arraysize=30<p>");
		Reporter.log("app.writepoints=0,5,10,15,20,25,30<p>");
		Reporter.log("app.commitinterval=5<p>");
		jobParams.put("execution.number", "1");
		jobParams.put("readrecord.fail", "12");
		jobParams.put("app.arraysize", "30");
		jobParams.put("app.writepoints", "0,5,10,15,20,25,30");
		jobParams.put("app.commitinterval", "5");


		Reporter.log("Locate job XML file: /chunksize5commitinterval5.xml<p>");

		Reporter.log("Invoke startJobAndWaitForResult for execution #1<p>");
		TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams);

		Reporter.log("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()+"<p>");
		Reporter.log("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()+"<p>");
		assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus());
		assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus());

		List<JobInstance> jobIds = null;
		boolean seenException = false;
		try {
			jobIds = jobOp.getJobInstances("NoSuchJob", 0, 12);
		} catch (NoSuchJobException noJobEx) {
			seenException = true;
			Reporter.log("Confirmed we caught NoSuchJobException<p>");
		}
		assertWithMessage("Saw NoSuchJobException for job 'NoSuchJob'", seenException);
	} catch (Exception e) {
		handleException(METHOD, e);
	}

}
 

开发者ID:WASdev,
项目名称:standards.jsr352.tck,
代码行数:47,
代码来源:JobOperatorTests.java

示例17: getJobInstances

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public List<JobInstance> getJobInstances(String jobName, int start,
		int count) throws NoSuchJobException, JobSecurityException {

	logger.entering(sourceClass, "getJobInstances", new Object[]{jobName, start, count});
	List<JobInstance> jobInstances = new ArrayList<JobInstance>();

	if (count == 0) {
		return new ArrayList<JobInstance>();
	} else if (count < 0) {
		throw new IllegalArgumentException("Count should be a positive integer (or 0, which will return an empty list)");
	}
	
	List<Long> instanceIds; 
	BatchSecurityHelper helper = getBatchSecurityHelper();
	if (isCurrentTagAdmin(helper)) {
		// Do an unfiltered query
		instanceIds	= persistenceService.jobOperatorGetJobInstanceIds(jobName, start, count);
	} else {
		instanceIds	= persistenceService.jobOperatorGetJobInstanceIds(jobName, helper.getCurrentTag(), start, count);
	}

	// get the jobinstance ids associated with this job name

	if (instanceIds.size() > 0){
		// for every job instance id
		for (long id : instanceIds){
			// get the job instance obj, add it to the list
			JobStatus jobStatus = this._jobStatusManagerService.getJobStatus(id);
			JobInstance jobInstance = jobStatus.getJobInstance();
			logger.finest("Matched jobInstance = " + jobInstance.getInstanceId());
			if(isAuthorized(jobInstance.getInstanceId())) {
				logger.finest("Authorized so adding to list jobInstance =  " + jobInstance.getInstanceId());
				jobInstances.add(jobInstance);	
			}
		}
		// send the list of objs back to caller
		logger.exiting(sourceClass, "getJobInstances", jobInstances);
		return jobInstances;
	} else {
		logger.fine("getJobInstances: Job Name " + jobName + " not found");
		throw new NoSuchJobException( "Job Name " + jobName + " not found");
	}
}
 

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

示例18: getJobInstanceCount

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public int getJobInstanceCount(final String name) throws NoSuchJobException, JobSecurityException {
    return getOrCreateDelegate().getJobInstanceCount(name);
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:5,
代码来源:SynchronousJobOperator.java

示例19: getJobInstances

点赞 2

import javax.batch.operations.NoSuchJobException; //导入依赖的package包/类
@Override
public List<JobInstance> getJobInstances(final String name, final int start, final int count) throws NoSuchJobException, JobSecurityException {
    return getOrCreateDelegate().getJobInstances(name, start, count);
}
 

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:5,
代码来源:SynchronousJobOperator.java

示例20: getRunningExecutions

点赞 2

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

开发者ID:apache,
项目名称:incubator-batchee,
代码行数:5,
代码来源:SynchronousJobOperator.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)