title: Controlling Task execution order with ExecutorService
body: <p>I have a process which delegates asynch tasks to a pool of threads.  I need to ensure that certain tasks are executed in order.
  So for example</p>
  
  <p>Tasks arrive in order</p>
  
  <p>Tasks  a1, b1, c1, d1 , e1, a2, a3, b2, f1</p>
  
  <p>Tasks can be executed in any order except where there is a natural dependancy, so a1,a2,a3 must be processed in that order by either allocating to the same thread or blocking these until I know the previous a# task was completed.</p>
  
  <p>Currently it doesn't use the Java Concurrency package, but I'm considering changing to take avantage of the thread management.</p>
  
  <p>Does anyone have a similar solution or suggestions of how to achieve this</p>