Stay organized with collections
Save and categorize content based on your preferences.
Delayed
public
interface
Delayed
implements
Comparable<Delayed>
java.util.concurrent.Delayed
|
Known indirect subclasses
|
A mix-in style interface for marking objects that should be
acted upon after a given delay.
An implementation of this interface must define a
compareTo
method that provides an ordering consistent with
its getDelay
method.
Summary
Public methods |
abstract
long
|
getDelay(TimeUnit unit)
Returns the remaining delay associated with this object, in the
given time unit.
|
Public methods
getDelay
public abstract long getDelay (TimeUnit unit)
Returns the remaining delay associated with this object, in the
given time unit.
Parameters |
unit |
TimeUnit : the time unit |
Returns |
long |
the remaining delay; zero or negative values indicate
that the delay has already elapsed |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Delayed\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nDelayed\n=======\n\n\n`\npublic\n\n\ninterface\nDelayed\n`\n\n\n`\n\n\nimplements\n\n`[Comparable](/reference/java/lang/Comparable)`\u003c`[Delayed](/reference/java/util/concurrent/Delayed)`\u003e\n\n\n`\n\n|------------------------------|\n| java.util.concurrent.Delayed |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [RunnableScheduledFuture](/reference/java/util/concurrent/RunnableScheduledFuture)\\\u003cV\\\u003e, [ScheduledFuture](/reference/java/util/concurrent/ScheduledFuture)\\\u003cV\\\u003e |-----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| | [RunnableScheduledFuture](/reference/java/util/concurrent/RunnableScheduledFuture)\\\u003cV\\\u003e | A [ScheduledFuture](/reference/java/util/concurrent/ScheduledFuture) that is [Runnable](/reference/java/lang/Runnable). | | [ScheduledFuture](/reference/java/util/concurrent/ScheduledFuture)\\\u003cV\\\u003e | A delayed result-bearing action that can be cancelled. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA mix-in style interface for marking objects that should be\nacted upon after a given delay.\n\nAn implementation of this interface must define a\n`compareTo` method that provides an ordering consistent with\nits `getDelay` method.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract long` | ` `[getDelay](/reference/java/util/concurrent/Delayed#getDelay(java.util.concurrent.TimeUnit))`(`[TimeUnit](/reference/java/util/concurrent/TimeUnit)` unit) ` Returns the remaining delay associated with this object, in the given time unit. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.lang.Comparable](/reference/java/lang/Comparable)` ` |-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int` | ` `[compareTo](/reference/java/lang/Comparable#compareTo(T))`(`[Delayed](/reference/java/util/concurrent/Delayed)` o) ` Compares this object with the specified object for order. | ||\n\nPublic methods\n--------------\n\n### getDelay\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract long getDelay (TimeUnit unit)\n```\n\nReturns the remaining delay associated with this object, in the\ngiven time unit.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|----------------------------------|\n| `unit` | `TimeUnit`: the time unit \u003cbr /\u003e |\n\n| Returns ||\n|--------|-------------------------------------------------------------------------------------------------|\n| `long` | the remaining delay; zero or negative values indicate that the delay has already elapsed \u003cbr /\u003e |"]]