I\'m just starting out coding in java i\'m in struggling with setting up a DelayQueue,
I wanted to have it so,
DelayQueue queue = new DelayQueue();
Your "custom delay" classes must return the delay from the getDelay(TimeUnit timeUnit) method specified in the Delayed interface.
E.g.
public class MyClass implements Delayed {
public long getDelay(TimeUnit timeUnit) {
long delay = calculateDelaySomehow();
return delay;
}
}
Note that you also need to provide an implementation for compareTo().