spring-batch

Ways to reduce memory churn

会有一股神秘感。 提交于 2019-11-30 13:20:03
问题 Background I have a Spring batch program that reads a file (example file I am working with is ~ 4 GB in size), does a small amount of processing on the file, and then writes it off to an Oracle database. My program uses 1 thread to read the file, and 12 worker threads to do the processing and database pushing. I am churning lots and lots and lots of young gen memory, which is causing my program to go slower than I think it should. Setup JDK 1.6.18 Spring batch 2.1.x 4 Core Machine w 16 GB ram

Why does destroy method 'close' fail for JPAPagingItemReader configured with Java config?

China☆狼群 提交于 2019-11-30 12:47:09
问题 We are trying to convert our Spring-Batch jobs from XML configuration to Java configuration. We are using Spring 4.0.1.RELEASE and Spring Batch 2.2.1.RELEASE. After converting one job, the following warning started to appear in the log file: 15-Apr-2014 09:59:26.335 [Thread-2] WARN o.s.b.f.s.DisposableBeanAdapter - Invocation of destroy method 'close' failed on bean with name 'fileReader': org.springframework.batch.item.ItemStreamException: Error while closing item reader The full stacktrace

how to stop spring batch scheduled jobs from running at first time when executing the code?

爱⌒轻易说出口 提交于 2019-11-30 12:36:56
问题 i'm using spring batch 2.2.4 with quartz to run some jobs at certain time the problem is the jobs always run after executing the code at the first time then it runs based on the scheduled time. I want to stop the first run and let it only runs based on the scheduled time. my cron expression is "0 0 0 * * ?" & I also tried "0 0 0 1/1 * ? *" but it still executes once when the application starts how can I stop the first execution when the application starts? this is the job context file: <batch

Transaction management with Spring Batch

主宰稳场 提交于 2019-11-30 12:19:58
问题 I am discovering actually Spring and I am able to setup some jobs. Now, I would like to save my imported datas in a database using Hibernate/JPA and I keep getting this error : 14:46:43.500 [main] ERROR o.s.b.core.step.AbstractStep - Encountered an error executing the step javax.persistence.TransactionRequiredException: no transaction is in progress I see that the problem is with the transaction. Here is my spring java config for the entityManager and the transactionManager : @Configuration

Spring Batch: starting a job from within a Spring MVC contorller WITH A NEW THREAD

。_饼干妹妹 提交于 2019-11-30 10:07:39
I have a Spring-Batch job that I launch from a Spring MVC controller. The controller gets an uploaded file from the user and the job is supposed to process the file: @RequestMapping(value = "/upload") public ModelAndView uploadInventory(UploadFile uploadFile, BindingResult bindingResult) { // code for saving the uploaded file to disk goes here... // now I want to launch the job of reading the file line by line and saving it to the database, // but I want to launch this job in a new thread, not in the HTTP request thread, // since I so not want the user to wait until the job ends. jobLauncher

How to get Job parameteres in to item processor using spring Batch annotation

老子叫甜甜 提交于 2019-11-30 10:01:21
I am using spring MVC. From my controller, I am calling jobLauncher and in jobLauncher I am passing job parameters like below and I'm using annotations to enable configuration as below: @Configuration @EnableBatchProcessing public class BatchConfiguration { // read, write ,process and invoke job } JobParameters jobParameters = new JobParametersBuilder().addString("fileName", "xxxx.txt").toJobParameters(); stasrtjob = jobLauncher.run(job, jobParameters); and here is my itemprocessor public class DataItemProcessor implements ItemProcessor<InputData, OutPutData> { public OutPutData process(final

How to control the number of parallel Spring Batch jobs

爷,独闯天下 提交于 2019-11-30 09:57:10
I have a report generating application. As preparation of such reports is heavyweight, they are prepared asynchronously with Spring Batch. Requests for such reports are created via REST interface using HTTP. The goal is that the REST resource simply queues report execution and completes ( as described in documentation ). Thus a TaskExecutor has been provided for the JobLauncher: <bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> <property name="taskExecutor"> <bean class="org.springframework.core

How to run Spring Batch Jobs in certain order (Spring Boot)?

北慕城南 提交于 2019-11-30 09:28:57
问题 I'm developing with Spring Batch using Spring Boot. I'm with the minimal configuration provided by Spring Boot and defined some Jobs (no XML configuration at all). But when I run the application, SpringApplication.run(App.class, args); the jobs are sequentially executed in some arbitrary order. I'm defining the jobs this way in @Configuration annotated classes, Spring do the rest: @Bean public Job requestTickets() { return jobBuilderFactory.get(Config.JOB_REQUEST_TICKETS) .start

Spring Batch - how to convert String from file to Date?

大兔子大兔子 提交于 2019-11-30 09:17:29
问题 I am trying to process a CSV file in which some of the fields are dates of the format "yyyy-MM-dd" - but the reader fails when it tries to convert the String from the CSV file to a Date in my model class. The error is: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 error Field error in object 'target' on field 'datetimeInactive': rejected value [2011-04-27]; codes [typeMismatch.target.datetimeInactive,typeMismatch.datetimeInactive

nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

一个人想着一个人 提交于 2019-11-30 09:08:28
问题 I already went through many links like Jedis, Cannot get jedis connection: cannot get resource from pool and Cannot get Jedis connection; Could not get a resource from the pool, but still getting the below error. I am using Spring Data Redis in Spring Batch and reading data from mysql and writing to redis DB. It seems some connection errors. The error below for reference. 2018-07-19 00:08:46 DEBUG o.s.t.support.TransactionTemplate - Initiating transaction rollback on application exception org