title: How to implement an ExecutorService to execute tasks on a rotation-basis?
body: <p>I'm using <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html" rel="noreferrer">java.util.concurrent.ExecutorService</a> with <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool%28int%29" rel="noreferrer">fixed thread pool</a> to execute list of tasks.  My list of tasks will typically be around 80 - 150 and I've limited the number of threads running at any time to 10 as shown below:</p>
  
  <pre><code>ExecutorService threadPoolService = Executors.newFixedThreadPool(10);
  
  for ( Runnable task : myTasks ) 
  {     
      threadPoolService.submit(task); 
  }
  </code></pre>
  
  <p>My use case demands that even the completed task should be re-submitted again to the <em>ExecutorService</em> but it should be executed/taken again only when all the <em>already</em> submitted tasks are serviced/completed.  That is basically, the tasks submitted should be executed on a rotation-basis.  Hence, there will not be either <code>threadPoolService.shutdown()</code> or <code>threadPoolService.shutdownNow()</code> call in this case.</p>
  
  <p>My question is, how do I implement <em>ExecutorService</em> servicing rotation-basis tasks?</p>