wood burning stoves 2.0*
The moose likes Spring and the fly likes spring batch threads not returning after execution of main thread is complete Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "spring batch threads not returning after execution of main thread is complete" Watch "spring batch threads not returning after execution of main thread is complete" New topic
Author

spring batch threads not returning after execution of main thread is complete

samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 192
Hello ranchers
I am novice to spring batch. I have created and successfully executed job from spring by using multiple threads and it works perfetly fine except that when program execution is complete, program flow does not comes to end/halt. i.e. even when the last statement of main method gets executed program does not exit. I am not sure whether it keeps on waiting for threads to complete or what. Can someone please advice on this ? "Below is my config file for job



And below is the launcher code



As stated above, the code runs in 5 different thread for the task "hello" and once for task "world" though it does not bring the execution of main program to halt even after the last line of main method "End of execution" gets executed. Any link white paper will greatly be appriciated.
Thanks in advance
Samir
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

You have used a thread pool executor, but nowhere have you setup the job so that it should run the "Hello" step five times.

Questions:
1) Are you sure the hello step is running 5 times? Do you see the hello-output getting printed 5 times?

Suggestions:
1) Run the code in eclipse in debug mode, you will be able to see which thread is stuck.

I don't see any reason why the program would not end.


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: spring batch threads not returning after execution of main thread is complete
 
Similar Threads
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
Help with Spring Batch (Newbie)
Spring Batch: Problem with commit-interval
Running a batch
Simple Spring Batch