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


Java JobStartException类代码示例

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


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

示例1: startJobAndWaitForResult

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

示例2: execute

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

示例3: startBatches

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

示例4: startJob

import javax.batch.operations.JobStartException; //导入依赖的package包/类
public static RuntimeJobExecution startJob(final ServicesManager servicesManager, final String jobXML, final Properties jobParameters) throws JobStartException {
    final JSLJob jobModel = new JobModelResolver().resolveModel(jobXML);
    final ModelNavigator<JSLJob> jobNavigator = getResolvedJobNavigator(jobModel, jobParameters, false);
    final JobContextImpl jobContext = getJobContext(jobNavigator);
    final JobInstance jobInstance = getNewJobInstance(servicesManager, jobNavigator.getRootModelElement().getId(), jobXML);
    final RuntimeJobExecution executionHelper =
            servicesManager.service(PersistenceManagerService.class).createJobExecution(jobInstance, jobParameters, jobContext.getBatchStatus());

    executionHelper.prepareForExecution(jobContext);

    final JobStatusManagerService statusManagerService = servicesManager.service(JobStatusManagerService.class);
    final JobStatus jobStatus = createNewJobStatus(statusManagerService, jobInstance);
    statusManagerService.updateJobStatus(jobStatus);

    return executionHelper;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:JobExecutionHelper.java

示例5: startPartition

import javax.batch.operations.JobStartException; //导入依赖的package包/类
public static RuntimeJobExecution startPartition(final ServicesManager servicesManager, final JSLJob jobModel, final Properties jobParameters) throws JobStartException {
    final ModelNavigator<JSLJob> jobNavigator = getResolvedJobNavigator(jobModel, jobParameters, true);
    final JobContextImpl jobContext = getJobContext(jobNavigator);

    final JobInstance jobInstance = getNewSubJobInstance(servicesManager, jobNavigator.getRootModelElement().getId());

    final RuntimeJobExecution executionHelper =
            servicesManager.service(PersistenceManagerService.class).createJobExecution(jobInstance, jobParameters, jobContext.getBatchStatus());

    executionHelper.prepareForExecution(jobContext);

    final JobStatusManagerService statusManagerService = servicesManager.service(JobStatusManagerService.class);
    final JobStatus jobStatus = createNewJobStatus(statusManagerService, jobInstance);
    statusManagerService.updateJobStatus(jobStatus);

    return executionHelper;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:18,代码来源:JobExecutionHelper.java

示例6: startInternal

import javax.batch.operations.JobStartException; //导入依赖的package包/类
private long startInternal(final String jobXMLName, final Properties jobParameters) throws JobStartException, JobSecurityException {
    final StringWriter jobParameterWriter = new StringWriter();
    if (jobParameters != null) {
        try {
            jobParameters.store(jobParameterWriter, "Job parameters on start: ");
        } catch (IOException e) {
            jobParameterWriter.write("Job parameters on start: not printable");
        }
    } else {
        jobParameterWriter.write("Job parameters on start = null");
    }

    final String jobXML = xmlLoaderService.loadJSL(jobXMLName);
    final InternalJobExecution execution = kernelService.startJob(jobXML, jobParameters);
    return execution.getExecutionId();
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:JobOperatorImpl.java

示例7: triggerJob

import javax.batch.operations.JobStartException; //导入依赖的package包/类
@Override
public long triggerJob(String jobName) throws BatchException {
    LOGGER.info("Starting execution of JOB {}", jobName);

    Properties jobParameters = getJobParameters(jobName);

    storeJobContent(jobName);
    try {
        return jsrJobOperator.start(jobName, jobParameters);
    } catch (JobStartException | JobSecurityException e) {
        throw new BatchException(ApplicationErrors.JOB_TRIGGER_FAILED, e,
                e.getMessage());
    }
}
 
开发者ID:motech,项目名称:modules,代码行数:15,代码来源:JobTriggerServiceImpl.java

示例8: startInternal

import javax.batch.operations.JobStartException; //导入依赖的package包/类
private long startInternal(String jobXMLName, Properties jobParameters)	throws JobStartException, JobSecurityException {

		StringWriter jobParameterWriter = new StringWriter();
		if (jobParameters != null) {
			try {
				jobParameters.store(jobParameterWriter, "Job parameters on start: ");
			} catch (IOException e) {
				jobParameterWriter.write("Job parameters on start: not printable");
			}
		} else {
			jobParameterWriter.write("Job parameters on start = null");
		}

		if (logger.isLoggable(Level.FINE)) {            
			logger.fine("JobOperator start, with jobXMLName = " + jobXMLName + "\n" + jobParameterWriter.toString());
		}

		String jobXML = jobXMLLoaderService.loadJSL(jobXMLName);

		long executionId = 0;

		if (logger.isLoggable(Level.FINE)) {            
			int concatLen = jobXML.length() > 200 ? 200 : jobXML.length();
			logger.fine("Starting job: " + jobXML.substring(0, concatLen) + "... truncated ...");
		}

		IJobExecution execution = batchKernel.startJob(jobXML, jobParameters);
		executionId = execution.getExecutionId();

		if (logger.isLoggable(Level.FINE)) {
			logger.fine("Started job with instanceId: " + execution.getInstanceId() + ", executionId: " + executionId);
		}

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

示例9: buildSubJobBatchWorkUnits

import javax.batch.operations.JobStartException; //导入依赖的package包/类
private void buildSubJobBatchWorkUnits() throws JobRestartException, JobStartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException  {
	synchronized (subJobs) {		
		//check if we've already issued a stop
		if (jobExecutionImpl.getJobContext().getBatchStatus().equals(BatchStatus.STOPPING)){
			logger.fine("Step already in STOPPING state, exiting from buildSubJobBatchWorkUnits() before beginning execution");
			return;
		}

		for (int instance = 0; instance < partitions; instance++) {
			subJobs.add(PartitionedStepBuilder.buildPartitionSubJob(jobExecutionImpl.getJobContext(), stepContext, step, instance));
		}

		PartitionsBuilderConfig config = new PartitionsBuilderConfig(subJobs, partitionProperties, analyzerStatusQueue, finishedWorkQueue, jobExecutionImpl.getExecutionId());
		// Then build all the subjobs but do not start them yet
		if (executionType == ExecutionType.RESTART_NORMAL) {				
			parallelBatchWorkUnits = batchKernel.buildOnRestartParallelPartitions(config);
		} else { 	
			// This case includes RESTART_OVERRIDE and RESTART_AFTER_COMPLETION.
			//
			// So we're just going to create new "subjob" job instances in the DB in these cases, 
			// and we'll have to make sure we're dealing with the correct ones, say in a subsequent "normal" restart
			// (of the current execution which is itself a restart)
			parallelBatchWorkUnits = batchKernel.buildNewParallelPartitions(config);
		}

		// NOTE:  At this point I might not have as many work units as I had partitions, since some may have already completed.
	}
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:29,代码来源:PartitionedStepControllerImpl.java

示例10: startJob

import javax.batch.operations.JobStartException; //导入依赖的package包/类
@Override
public IJobExecution startJob(String jobXML, Properties jobParameters) throws JobStartException {
	String method = "startJob";

	if (logger.isLoggable(Level.FINER)) {
		logger.entering(sourceClass, method, new Object[] { jobXML, jobParameters != null ? jobParameters : "<null>" });
	}

	RuntimeJobExecution jobExecution = JobExecutionHelper.startJob(jobXML, jobParameters);

	// TODO - register with status manager

	if (logger.isLoggable(Level.FINE)) {
		logger.fine("JobExecution constructed: " + jobExecution);
	}

	BatchWorkUnit batchWork = new BatchWorkUnit(this, jobExecution);
	registerCurrentInstanceAndExecution(jobExecution, batchWork.getController());

	executorService.executeTask(batchWork, null);

	if (logger.isLoggable(Level.FINER)) {
		logger.exiting(sourceClass, method, jobExecution);
	}

	return jobExecution.getJobOperatorJobExecution();
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:28,代码来源:BatchKernelImpl.java

示例11: buildNewParallelPartitions

import javax.batch.operations.JobStartException; //导入依赖的package包/类
/**
 * Build a list of batch work units and set them up in STARTING state but don't start them yet.
 */

@Override
public List<BatchPartitionWorkUnit> buildNewParallelPartitions(PartitionsBuilderConfig config) 
		throws JobRestartException, JobStartException {

	List<JSLJob> jobModels = config.getJobModels();
	Properties[] partitionPropertiesArray = config.getPartitionProperties();

	List<BatchPartitionWorkUnit> batchWorkUnits = new ArrayList<BatchPartitionWorkUnit>(jobModels.size());

	int instance = 0;
	for (JSLJob parallelJob  : jobModels){
		Properties partitionProps = (partitionPropertiesArray == null) ? null : partitionPropertiesArray[instance];    			

		if (logger.isLoggable(Level.FINER)) {
			logger.finer("Starting execution for jobModel = " + parallelJob.toString());
		}
		RuntimeJobExecution jobExecution = JobExecutionHelper.startPartition(parallelJob, partitionProps);
		jobExecution.setPartitionInstance(instance);

		if (logger.isLoggable(Level.FINE)) {
			logger.fine("JobExecution constructed: " + jobExecution);
		}
		BatchPartitionWorkUnit batchWork = new BatchPartitionWorkUnit(this, jobExecution, config);

		registerCurrentInstanceAndExecution(jobExecution, batchWork.getController());
		
		batchWorkUnits.add(batchWork);
		instance++;
	}

	return batchWorkUnits;
}
 
开发者ID:WASdev,项目名称:standards.jsr352.jbatch,代码行数:37,代码来源:BatchKernelImpl.java

示例12: buildNewParallelPartitions

import javax.batch.operations.JobStartException; //导入依赖的package包/类
/**
 * Build a list of batch work units and set them up in STARTING state but don't start them yet.
 */

@Override
public List<BatchPartitionWorkUnit> buildNewParallelPartitions(final PartitionsBuilderConfig config, final JobContextImpl jc, final StepContextImpl sc)
    throws JobRestartException, JobStartException {

    final List<JSLJob> jobModels = config.getJobModels();
    final Properties[] partitionPropertiesArray = config.getPartitionProperties();
    final List<BatchPartitionWorkUnit> batchWorkUnits = new ArrayList<BatchPartitionWorkUnit>(jobModels.size());

    int instance = 0;
    for (final JSLJob parallelJob : jobModels) {
        final Properties partitionProps = (partitionPropertiesArray == null) ? null : partitionPropertiesArray[instance];
        final RuntimeJobExecution jobExecution = JobExecutionHelper.startPartition(servicesManager, parallelJob, partitionProps);
        jobExecution.inheritJobContext(jc);
        jobExecution.setPartitionInstance(instance);

        final BatchPartitionWorkUnit batchWork = new BatchPartitionWorkUnit(jobExecution, config, servicesManager);
        batchWork.inheritStepContext(sc);

        registerCurrentInstanceAndExecution(jobExecution, batchWork.getController());

        batchWorkUnits.add(batchWork);
        instance++;
    }

    return batchWorkUnits;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:31,代码来源:DefaultBatchKernel.java

示例13: startFlowInSplit

import javax.batch.operations.JobStartException; //导入依赖的package包/类
public static RuntimeFlowInSplitExecution startFlowInSplit(final ServicesManager servicesManager, final JSLJob jobModel) throws JobStartException {
    final ModelNavigator<JSLJob> jobNavigator = getResolvedJobNavigator(jobModel, null, true);
    final JobContextImpl jobContext = getJobContext(jobNavigator);
    final JobInstance jobInstance = getNewSubJobInstance(servicesManager, jobNavigator.getRootModelElement().getId());
    final RuntimeFlowInSplitExecution executionHelper =
            servicesManager.service(PersistenceManagerService.class).createFlowInSplitExecution(jobInstance, jobContext.getBatchStatus());

    executionHelper.prepareForExecution(jobContext);

    final JobStatusManagerService statusManagerService = servicesManager.service(JobStatusManagerService.class);
    final JobStatus jobStatus = createNewJobStatus(statusManagerService, jobInstance);
    statusManagerService.updateJobStatus(jobStatus);

    return executionHelper;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:16,代码来源:JobExecutionHelper.java

示例14: execute

import javax.batch.operations.JobStartException; //导入依赖的package包/类
@Override
public SplitExecutionStatus execute()
        throws JobRestartException, JobStartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, NoSuchJobExecutionException {
    // Build all sub jobs from partitioned step
    buildSubJobBatchWorkUnits();

    // kick off the threads
    executeWorkUnits();

    // Deal with the results.
    return waitForCompletionAndAggregateStatus();
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:13,代码来源:SplitController.java

示例15: buildSubJobBatchWorkUnits

import javax.batch.operations.JobStartException; //导入依赖的package包/类
private void buildSubJobBatchWorkUnits() throws JobRestartException, JobStartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException {
    synchronized (subJobs) {
        //check if we've already issued a stop
        if (jobExecutionImpl.getJobContext().getBatchStatus().equals(BatchStatus.STOPPING)) {
            return;
        }

        for (int instance = 0; instance < partitions; instance++) {
            subJobs.add(PartitionedStepBuilder.buildPartitionSubJob(jobExecutionImpl.getInstanceId(), jobExecutionImpl.getJobContext(), step, instance));
        }

        PartitionsBuilderConfig config =
                new PartitionsBuilderConfig(subJobs, partitionProperties, analyzerStatusQueue, completedWorkQueue, jobExecutionImpl.getExecutionId());
        // Then build all the subjobs but do not start them yet
        if (executionType == ExecutionType.RESTART_NORMAL) {
            parallelBatchWorkUnits = kernelService.buildOnRestartParallelPartitions(config, jobExecutionImpl.getJobContext(), stepContext);
        } else {
            // This case includes RESTART_OVERRIDE and RESTART_AFTER_COMPLETION.
            //
            // So we're just going to create new "subjob" job instances in the DB in these cases,
            // and we'll have to make sure we're dealing with the correct ones, say in a subsequent "normal" restart
            // (of the current execution which is itself a restart)
            parallelBatchWorkUnits = kernelService.buildNewParallelPartitions(config, jobExecutionImpl.getJobContext(), stepContext);
        }

        // NOTE:  At this point I might not have as many work units as I had partitions, since some may have already completed.
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:29,代码来源:PartitionedStepController.java


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