DelayQueue implementation in Java
问题 I'm a beginner in understanding threads and concurrency package. Understood that to use java.util.concurrent.DelayedQueue we have to implement the java.util.concurrent.Delayed interface and it has a abstract method getDelay() long getDelay(TimeUnit unit) Returns the remaining delay associated with this object, in the given time unit. @Override public long getDelay(TimeUnit unit) { long diff = startTime - System.currentTimeMillis(); // long variable return unit.convert(diff, TimeUnit