Name

Delayed

Synopsis

An object that implements this interface has an associated delay. Typically, it is some kind of task, such as a Callable, that has been scheduled to execute at some future time. getDelay( ) returns the remaining time, measured in the specified TimeUnit. If no time remains, getDelay( ) should return zero or a negative value. See ScheduledFuture and DelayQueue.

java.util.concurrent.Delayed

Figure 16-80. java.util.concurrent.Delayed

public interface Delayed extends Comparable<Delayed> {
// Public Instance Methods
     long getDelay(TimeUnit unit);  
}

Implementations

ScheduledFuture

Passed To

DelayQueue.{add( ), offer( ), put( )}

Returned By

DelayQueue.{peek( ), poll( ), take( )}

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.