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


Java RepeatStatus.FINISHED属性代码示例

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


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

示例1: execute

/**
 * Executes the task as specified by the taskName with the associated
 * properties and arguments.
 * @param contribution mutable state to be passed back to update the current step execution
 * @param chunkContext contains the task-execution-id used by the listener.
 * @return Repeat status of FINISHED.
 */
@Override
public RepeatStatus execute(StepContribution contribution,
		ChunkContext chunkContext) throws Exception {
	String tmpTaskName = this.taskName.substring(0,
			this.taskName.lastIndexOf('_'));

	List<String> args = this.arguments;

	ExecutionContext stepExecutionContext = chunkContext.getStepContext().getStepExecution().
			getExecutionContext();
	if(stepExecutionContext.containsKey("task-arguments")) {
		args = (List<String>) stepExecutionContext.get("task-arguments");
	}

	long executionId = this.taskOperations.launch(tmpTaskName,
			this.properties, args);

	stepExecutionContext.put("task-execution-id", executionId);
	stepExecutionContext.put("task-arguments", args);

	waitForTaskToComplete(executionId);

	return RepeatStatus.FINISHED;
}
 
开发者ID:spring-cloud-task-app-starters,项目名称:composed-task-runner,代码行数:31,代码来源:TaskLauncherTasklet.java

示例2: execute

@Override
@Transactional
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
	Query<String> query = currentSession().createQuery(queryString, String.class);
	query.setMaxResults(1);
	query.setFirstResult(0);

	try {
		String result = query.getSingleResult();
		chunkContext.getStepContext().getStepExecution().getJobExecution().getExecutionContext().put("record.identifier", result);
		contribution.setExitStatus(new ExitStatus("MORE_RESULTS"));
	} catch (NoResultException e) {
		contribution.setExitStatus(new ExitStatus("NO_MORE_RESULTS"));
	}

	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:powop,代码行数:17,代码来源:SingleRecordQueryTasklet.java

示例3: execute

public final RepeatStatus execute(final StepContribution contribution,
		final ChunkContext chunkContext) throws Exception {
	Map<String,String> defaultValuesMap = new HashMap<String,String>();
	if(this.defaultValues != null) {
		String values = defaultValues.substring(1, this.defaultValues.length() - 1);
		for(String defaultValue : values.split(",")) {
			if(defaultValue.indexOf("=") > -1) {
				String field = defaultValue.substring(0,defaultValue.indexOf("="));
				String value = defaultValue.substring(defaultValue.indexOf("=") + 1, defaultValue.length());
				defaultValuesMap.put(field,value);
			}
		}
	}
	chunkContext.getStepContext().getStepExecution()
	.getJobExecution().getExecutionContext().put(defaultValuesKey, defaultValuesMap);
	logger.debug("SETTING " + defaultValuesKey + " as " + defaultValuesMap);
	String names = fieldNames.substring(1, this.fieldNames.length() - 1);
	String[] fieldNamesArray = names.split(",");
	chunkContext.getStepContext().getStepExecution()
	.getJobExecution().getExecutionContext().put(fieldNamesKey, fieldNamesArray);
	logger.debug("SETTING " + fieldNamesKey + " as " + Arrays.toString(fieldNamesArray));
	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:powop,代码行数:23,代码来源:ParameterConvertingTasklet.java

示例4: execute

@Override
public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) {
    Object parametersObj = chunkContext.getStepContext().getJobParameters().get("JobParameters");
    String jobParameters = String.valueOf(System.currentTimeMillis());
    String params = "(";
    if (parametersObj != null) {
        jobParameters = parametersObj.toString();
        String[] p = jobParameters.split(" ");
        for (int i = 0; i < p.length; i++) {
            if (i == 0) {
                params += "'" + p[i] + "'";
            } else {
                params += ",'" + p[i] + "'";
            }
        }
    }
    params += ")";
    try {
        logger.info("program is :" + scriptFile + ", argument is:" + params);
        jdbcTemplate.execute("call " + scriptFile + params);
    } catch (Exception e) {
        logger.error(e.getMessage());
        chunkContext.getStepContext().getStepExecution().setExitStatus(ExitStatus.FAILED);
    }
    return RepeatStatus.FINISHED;
}
 
开发者ID:hzwy23,项目名称:batch-scheduler,代码行数:26,代码来源:ProcTasklet.java

示例5: execute

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    logger.info("Started MappingParserTask");
    // Delete the files that are error out in previous run
    Arrays.stream(new File(propertyConstants.getReportDir()).listFiles()).forEach(File::delete);
    logger.debug("Found Mapping file:: " + propertyConstants.getMappingJsonPath());

    // Create the mapping between Hub and Fortify
    final List<BlackDuckFortifyMapperGroup> groupMap = mappingParser.createMapping(propertyConstants.getMappingJsonPath());
    logger.info("blackDuckFortifyMappers :" + groupMap.toString());

    // Create the threads for parallel processing
    ExecutorService exec = Executors.newFixedThreadPool(propertyConstants.getMaximumThreadSize());
    List<Future<?>> futures = new ArrayList<>(groupMap.size());
    for (BlackDuckFortifyMapperGroup blackDuckFortifyMapperGroup : groupMap) {
        futures.add(exec.submit(new BlackDuckFortifyPushThread(blackDuckFortifyMapperGroup,
                hubServices, fortifyFileTokenApi, fortifyUploadApi, propertyConstants)));
    }
    for (Future<?> f : futures) {
        f.get(); // wait for a processor to complete
    }

    jobStatus = true;
    logger.info("After all threads processing");
    return RepeatStatus.FINISHED;
}
 
开发者ID:blackducksoftware,项目名称:hub-fortify-ssc-integration-service,代码行数:26,代码来源:Initializer.java

示例6: execute

@Override
public RepeatStatus execute(final StepContribution contribution,
                            final ChunkContext chunkContext) throws Exception {
    final Stopwatch stopwatch = Stopwatch.createStarted();
    final Path tempFile = Files.createTempFile(FILE_PREFIX, FILE_SUFFIX);

    try {
        final Path path = lupahallintaHttpClient.downloadClubCSV(tempFile);

        LOG.info("Download completed successfully in {}, inputFile={}", stopwatch, path);

        chunkContext.getStepContext()
                .getStepExecution()
                .getJobExecution()
                .getExecutionContext()
                .put(KEY_INPUT_FILE, path.toString());

    } catch (final Exception ex) {
        Files.deleteIfExists(tempFile);
        throw ex;
    }

    return RepeatStatus.FINISHED;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:24,代码来源:LHHuntingClubCSVDownloader.java

示例7: execute

@Override
public RepeatStatus execute(final StepContribution contribution,
                            final ChunkContext chunkContext) throws Exception {
    final MetsastajaRekisteriJobParameters jobParameters = new MetsastajaRekisteriJobParameters(
            chunkContext.getStepContext().getJobParameters());

    final Path sourcePath = Paths.get(jobParameters.getInputFile());
    final File sourceFile = sourcePath.toFile();

    final UUID uuid = UUID.randomUUID();

    LOG.info("Archiving file with UUID={} filename={}", uuid, sourceFile.getName());

    fileStorageService.storeFile(
            uuid,
            sourceFile,
            FileType.METSASTAJAREKISTERI,
            "application/octet-stream",
            sourceFile.getName());

    Files.delete(sourcePath);

    return RepeatStatus.FINISHED;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:24,代码来源:MetsastajaRekisteriArchiveTasklet.java

示例8: execute

public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    if (init) {
        init();
        log.info("the batch process inits completely.");
        init = false;
    }

    try {
        contribution.setExitStatus(mapResult(execute(chunkContext)));
        Thread.sleep(getSleepTime());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    } finally {
        synchronized (lock) {
            if (stop) {
                lock.notifyAll();
                log.info("business is executed compeletly!");

                return RepeatStatus.FINISHED;
            }
        }
    }

    return RepeatStatus.CONTINUABLE;
}
 
开发者ID:sunguangran,项目名称:navi,代码行数:25,代码来源:AbstractNaviLongTasklet.java

示例9: execute

@Override
public RepeatStatus execute(StepContribution arg0, ChunkContext arg1) throws Exception {

	Long time = Calendar.getInstance().getTimeInMillis();
	String exit;
	if(time % 2 == 0){
		exit = ExitStatus.NOOP.getExitCode().toString();
		arg0.setExitStatus(ExitStatus.NOOP);
	}else{
		exit = ExitStatus.COMPLETED.getExitCode().toString();
		arg0.setExitStatus(ExitStatus.COMPLETED);
	}
	
	System.out.println("Executing step with name " + taskletName + " and exitCode " + exit);
	
	return RepeatStatus.FINISHED;
}
 
开发者ID:maldiny,项目名称:Spring-Batch-en-Castellano,代码行数:17,代码来源:CustomConditionalTasklet.java

示例10: execute

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    if (marklogicVersion.equals("8")) {
        QueryManager qryMgr = databaseClient.newQueryManager();
        GenericDocumentManager docMgr = databaseClient.newDocumentManager();
        SearchHandle handle = qryMgr.search(queryDefinition, new SearchHandle());
        MatchDocumentSummary[] results = handle.getMatchResults();
        for (int i = 0; i < results.length; i++) {
            docMgr.delete(results[i].getUri());
        }
    } else if (marklogicVersion.equals("9")) {
        final DataMovementManager dataMovementManager = databaseClient.newDataMovementManager();
        QueryBatcher qb = dataMovementManager.newQueryBatcher(queryDefinition)
                .withBatchSize(2500)
                .withConsistentSnapshot()
                .onUrisReady(new DeleteListener())
                .onQueryFailure(throwable -> throwable.printStackTrace());
        JobTicket ticket = dataMovementManager.startJob(qb);
        qb.awaitCompletion();
        dataMovementManager.stopJob(ticket);

    }
    return RepeatStatus.FINISHED;
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:24,代码来源:DeleteDocumentsTasklet.java

示例11: execute

/**
 * @param contribution Set the step contribution
 * @param chunkContext Set the chunk context
 * @return the repeat status
 * @throws Exception if there is a problem deleting the resources
 */
public final RepeatStatus execute(final StepContribution contribution, final ChunkContext chunkContext) throws Exception {
	UUID uuid = UUID.randomUUID();
	String unpackDirectoryName = harvesterSpoolDirectory + File.separator + uuid.toString();
	String temporaryFileName = harvesterSpoolDirectory + File.separator + uuid.toString() + ".zip";

	File unpackDirectory = new File(unpackDirectoryName);
	unpackDirectory.mkdir();
	File temporaryFile = new File(temporaryFileName);
	ExecutionContext executionContext = chunkContext.getStepContext().getStepExecution().getJobExecution().getExecutionContext();
	executionContext.put("temporary.file.name", temporaryFile.getAbsolutePath());
	executionContext.put("unpack.directory.name", unpackDirectory.getAbsolutePath());
	executionContext.putLong("job.execution.id", chunkContext.getStepContext().getStepExecution().getJobExecutionId());
	log.debug("setting temporary.file.name to {}", temporaryFile.getAbsolutePath());
	log.debug("execution context: {}", executionContext);
	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:powop,代码行数:22,代码来源:SetTemporaryFilenamesTasklet.java

示例12: execute

@Override
@Transactional
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
	Query query = this.getSession().createQuery(queryString);
	query.setMaxResults(1);
	query.setFirstResult(0);

	List<String> results = (List<String>)query.list();

	if(results.size() == 0) {
		contribution.setExitStatus(new ExitStatus("NO_MORE_RESULTS"));
	} else {
		chunkContext.getStepContext().getStepExecution().getJobExecution().getExecutionContext().put("record.identifier", results.get(0));
		contribution.setExitStatus(new ExitStatus("MORE_RESULTS"));
	}


	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:19,代码来源:SingleRecordQueryTasklet.java

示例13: execute

/**
 * @param contribution Set the step contribution
 * @param chunkContext Set the chunk context
 * @return the repeat status
 * @throws Exception if there is a problem deleting the resources
 */
public final RepeatStatus execute(final StepContribution contribution, final ChunkContext chunkContext)
		throws Exception {
	UUID uuid = UUID.randomUUID();
	String unpackDirectoryName = harvesterSpoolDirectory + File.separator
			+ uuid.toString();
	String temporaryFileName = harvesterSpoolDirectory + File.separator
			+ uuid.toString() + ".zip";

	File unpackDirectory = new File(unpackDirectoryName);
	unpackDirectory.mkdir();
	File temporaryFile = new File(temporaryFileName);
	ExecutionContext executionContext = chunkContext.getStepContext()
			.getStepExecution().getJobExecution().getExecutionContext();
	executionContext.put("temporary.file.name",temporaryFile.getAbsolutePath());
	executionContext.put("unpack.directory.name",unpackDirectory.getAbsolutePath());
	executionContext.putLong("job.execution.id", chunkContext.getStepContext().getStepExecution().getJobExecutionId());
	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:24,代码来源:SetTemporaryFilenamesTasklet.java

示例14: execute

@Override
public RepeatStatus execute(StepContribution contribution,
		ChunkContext chunkContext) throws Exception {

	CoreAdminResponse coreAdminResponse = CoreAdminRequest.getStatus(core, solrServer);
	NamedList<Object> index = (NamedList<Object>)coreAdminResponse.getCoreStatus(core).get("index");
	Integer segmentCount = (Integer)index.get("segmentCount");

	if(segmentCount < maxSegments) {
		logger.debug("Core " + core + " only has " + segmentCount + " segments, skipping optimization");
	} else {
		logger.debug("Core " + core + " has " + segmentCount + " segments, starting optimization");
		solrServer.optimize(true, true);
		logger.debug("Core " + core + " optimized");
	}

	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:18,代码来源:SolrOptimizingTasklet.java

示例15: execute

/**
 * @param contribution
 *            Set the step contribution
 * @param chunkContext
 *            Set the chunk context
 * @return the repeat status
 * @throws Exception
 *             if there is a problem
 */
public final RepeatStatus execute(final StepContribution contribution,
		final ChunkContext chunkContext) throws Exception {
	// Set up input documents
	Source inputXML = new StreamSource(inputFile.getFile());

	Source inputXSL = new StreamSource(xsltFile.getFile());

	// Set up output sink
	Result outputXHTML = new StreamResult(outputFile.getFile());

	// Setup a factory for transforms
	TransformerFactory factory = TransformerFactory.newInstance();
	Transformer transformer = factory.newTransformer(inputXSL);
	for (String parameterName : parameters.keySet()) {
		transformer.setParameter(parameterName,
				parameters.get(parameterName));
	}
	if(errorListener != null) {
		transformer.setErrorListener(errorListener);
	}
	transformer.transform(inputXML, outputXHTML);
	return RepeatStatus.FINISHED;
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:32,代码来源:XmlTransformingTasklet.java


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