I'm trying to create an Executor Service using a DelayQueue for the blocking queue with Java 8. I created a class that implements Runnable and Delayed, and implemented the required methods:
public class CurlEvent implements Runnable, Delayed {...} I constructed the queue, then the ExecutorService:
BlockingQueue<CurlEvent> queue = new DelayQueue<>(); ThreadPoolExecutor executor = new ThreadPoolExecutor(threads, threads, 36, TimeUnit.HOURS, queue); The compiler flagged an error for the ThreadPoolExecutor constructor, even though CurlEvent implements Runnable:
java: incompatible types: java.util.concurrent.BlockingQueue<com.dtna.web.test.playback.CurlEvent> cannot be converted to java.util.concurrent.BlockingQueue<java.lang.Runnable> There must be some way around this. I can move to a later Java release if necessary