I’m a newbie on Spring-Batch and I want to use it to batch some jobs which use a legacy library. This library has the disadvantages:
- to be not thread-safe
- an instance of some objects in the library cannot handle several jobs in a row (due to enclosed singleton static instances).
Thus, it seems the only solution is to fork the JVM for each job.
My question is: how can i do this using spring-batch ? Most of the solutions in the documentation are thread-oriented.
“fork the JVM” – how would you do that? Launch a new process altogether? But that won’t really “fork” the JVM – meaning any state information you need to copy to the “child” JVM will have to be done manually.
How about somehow using a different Classloader for each job?