 <p>There is a fairly easy solution to the System.exit problem. Where you had: </p> <pre><code> System.out.println("the size of Hashmap is: " + jobCountMap.size()); System.exit(job.waitForCompletion(true) ? 0 : 1); </code></pre> <p>Instead place the following: </p> <pre><code>System.out.println("the size of Hashmap is: " + jobCountMap.size()); boolean completionStatus = job.waitForCompletion(true); //your code here if(completionStatus==true){ System.exit(0) }else{ System.exit(1) } </code></pre> <p>This should allow you to run any processing you want within your main function, including starting a second job if you want.</p>