• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London

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

Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 608
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have used a thread pool executor, but nowhere have you setup the job so that it should run the "Hello" step five times.

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

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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic