title: Multithreading best practices : constraining tasks newFixedThreadPool
body: <p>I want to launch a lot of tasks to run on a database of +-42Mio records. I want to run this in batches of 5000 records/time (results in 850 tasks).
  I also want to limit the number of threads (to 16) java starts to do this for me and I am using the current code to accomplish this task:</p>
  
  <pre><code> ExecutorService executorService = Executors.newFixedThreadPool(16);
   for (int j = 1; j &lt; 900 + 1; j++) {
       int start = (j - 1) * 5000;
       int stop = (j) * 5000- 1;
       FetcherRunner runner = new FetcherRunner(routes, start, stop);
       executorService.submit(runner);
  
       Thread t = new Thread(runner);
       threadsList.add(t);
       t.start();
   }
  </code></pre>
  
  <p>Is this the correct way to do this?  Particularly as I have the impression that java just fires away all tasks ...(<code>FetcherRunner</code> implements <code>runnable</code>)</p>