java.util.concurrent.Delayed 接口 源碼 原

線程池相關

源碼:

package java.util.concurrent;

public interface Delayed extends Comparable<Delayed> {
    //返回與此對象相關的剩餘延遲時間,以給定的時間單位表示
    long getDelay(TimeUnit unit);
}

接口 Delayed

所有超級接口:

    ComparableDelayed>

所有已知子接口:

    RunnableScheduledFuture<V>, ScheduledFuture<V>

    一種混合風格的接口,用來標記那些應該在給定延遲時間之後執行的對象。

    此接口的實現必須定義一個 compareTo 方法,該方法提供與此接口的 getDelay 方法一致的排序。

 

從接口 java.lang.Comparable 繼承的方法

compareTo

 

  

getDelay

long getDelay(TimeUnit unit)

    返回與此對象相關的剩餘延遲時間,以給定的時間單位表示。

    參數:

    unit - 時間單位

    返回:

        剩餘延遲時間;零或負值指示延遲時間已經用盡

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章