title: Running java runtime.exec() for multiple process
body: <p>In my program  I do have a list of <code>n</code> items.</p>
  
  <p>I will be iterating the list and initiate a process like this:</p>
  
  <pre><code>Runtime.getRuntime.exec("cmd /C start abc.bat"+listitem() )
  </code></pre>
  
  <p>I need to maintain a count of 4 processes. Once any one of the process is completed, I need to start the next process , so the process count should be 4.</p>
  
  <p>I am able to initiate 4 process simultaneously, but not sure on how to keep the count of 4. Basically I need some notification once a process is terminated, so I can start the next, any threading is possible.</p>
  
  <p>Any help on how to implement this, can somebody share a snippet on this above requirement?</p>