Limiting one of each Runnable type in ExecutorService queue.

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-04-08T01:01:55Z Indexed on 2010/04/08 1:03 UTC
Read the original article Hit count: 360

I have an Executors.newFixedThreadPool(1) that I send several different tasks to (all implementing Runnable), and they get queued up and run sequentially correct? What is the best way to only allow one of each task to be either running or queued up at one time? I want to ignore all tasks sent to the ExecutorService that are already in the queue.

© Stack Overflow or respective owner

Related posts about java

Related posts about multithreading