| Delayed.java |
1 /*
2 * %W% %E%
3 *
4 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6 */
7
8 package java.util.concurrent;
9
10 import java.util.*;
11
12 /**
13 * A mix-in style interface for marking objects that should be
14 * acted upon after a given delay.
15 *
16 * <p>An implementation of this interface must define a
17 * <tt>compareTo</tt> method that provides an ordering consistent with
18 * its <tt>getDelay</tt> method.
19 *
20 * @since 1.5
21 * @author Doug Lea
22 */
23 public interface Delayed extends Comparable<Delayed> {
24
25 /**
26 * Returns the remaining delay associated with this object, in the
27 * given time unit.
28 *
29 * @param unit the time unit
30 * @return the remaining delay; zero or negative values indicate
31 * that the delay has already elapsed
32 */
33 long getDelay(TimeUnit unit);
34 }
35