title: Specify task order execution in Java
body: <p>I've searched a lot but couldn't find any solution.
  I use java thread pool in such way:</p>
  
  <pre><code>ExecutorService c = Executors.newFixedThreadPool(3);
  for (int i = 0; i &lt; 10; ++i) {
    c.execute(new MyTask(i));
  }
  </code></pre>
  
  <p>In such way Tasks are executed in consequent order (as in queue). But I need change "select next task" strategy. So I want assign to each task specify priority (it isn't thread priority) and execute tasks correspond to these priorities. So when executor have finished another task it chooses next task as task with maximum priority. 
  It describes common problem. Maybe there is more simple approach which doesn't account priorities. It selects last added task as next to execute instead of first added. Roughly speaking FixedThreadPool use FIFO strategy. Can I use for example LIFO strategy?</p>