Stay organized with collections
Save and categorize content based on your preferences.
RunnableScheduledFuture
public
interface
RunnableScheduledFuture
implements
RunnableFuture<V>,
ScheduledFuture<V>
java.util.concurrent.RunnableScheduledFuture<V>
|
A ScheduledFuture
that is Runnable
. Successful
execution of the run
method causes completion of the
Future
and allows access to its results.
Summary
Public methods |
abstract
boolean
|
isPeriodic()
Returns true if this task is periodic.
|
Inherited methods |
|
From interface
java.util.concurrent.Future
abstract
boolean
|
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task.
|
default
Throwable
|
exceptionNow()
Returns the exception thrown by the task, without waiting.
|
abstract
V
|
get(long timeout, TimeUnit unit)
Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available.
|
abstract
V
|
get()
Waits if necessary for the computation to complete, and then
retrieves its result.
|
abstract
boolean
|
isCancelled()
Returns true if this task was cancelled before it completed
normally.
|
abstract
boolean
|
isDone()
Returns true if this task completed.
|
default
V
|
resultNow()
Returns the computed result, without waiting.
|
default
Future.State
|
state()
|
|
From interface
java.lang.Runnable
abstract
void
|
run()
When an object implementing interface Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread.
|
|
|
|
Public methods
isPeriodic
public abstract boolean isPeriodic ()
Returns true
if this task is periodic. A periodic task may
re-run according to some schedule. A non-periodic task can be
run only once.
Returns |
boolean |
true if this task is periodic |
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-03-13 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-03-13 UTC."],[],[],null,["# RunnableScheduledFuture\n\nAdded in [API level 9](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nRunnableScheduledFuture\n=======================\n\n\n`\npublic\n\n\ninterface\nRunnableScheduledFuture\n`\n\n\n`\n\n\nimplements\n\n`[RunnableFuture](/reference/java/util/concurrent/RunnableFuture)`\u003cV\u003e,\n\n`[ScheduledFuture](/reference/java/util/concurrent/ScheduledFuture)`\u003cV\u003e\n\n\n`\n\n|---------------------------------------------------|\n| java.util.concurrent.RunnableScheduledFuture\\\u003cV\\\u003e |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA [ScheduledFuture](/reference/java/util/concurrent/ScheduledFuture) that is [Runnable](/reference/java/lang/Runnable). Successful\nexecution of the `run` method causes completion of the\n`Future` and allows access to its results. \n**See also:**\n\n- [FutureTask](/reference/java/util/concurrent/FutureTask)\n- [Executor](/reference/java/util/concurrent/Executor)\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[isPeriodic](/reference/java/util/concurrent/RunnableScheduledFuture#isPeriodic())`() ` Returns `true` if this task is periodic. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.util.concurrent.RunnableFuture](/reference/java/util/concurrent/RunnableFuture)` ` |------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[run](/reference/java/util/concurrent/RunnableFuture#run())`() ` Sets this Future to the result of its computation unless it has been cancelled. | ||\n| From interface ` `[java.util.concurrent.Future](/reference/java/util/concurrent/Future)` ` |-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[cancel](/reference/java/util/concurrent/Future#cancel(boolean))`(boolean mayInterruptIfRunning) ` Attempts to cancel execution of this task. | | ` default `[Throwable](/reference/java/lang/Throwable) | ` `[exceptionNow](/reference/java/util/concurrent/Future#exceptionNow())`() ` Returns the exception thrown by the task, without waiting. | | ` abstract V` | ` `[get](/reference/java/util/concurrent/Future#get(long,%20java.util.concurrent.TimeUnit))`(long timeout, `[TimeUnit](/reference/java/util/concurrent/TimeUnit)` unit) ` Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. | | ` abstract V` | ` `[get](/reference/java/util/concurrent/Future#get())`() ` Waits if necessary for the computation to complete, and then retrieves its result. | | ` abstract boolean` | ` `[isCancelled](/reference/java/util/concurrent/Future#isCancelled())`() ` Returns `true` if this task was cancelled before it completed normally. | | ` abstract boolean` | ` `[isDone](/reference/java/util/concurrent/Future#isDone())`() ` Returns `true` if this task completed. | | ` default V` | ` `[resultNow](/reference/java/util/concurrent/Future#resultNow())`() ` Returns the computed result, without waiting. | | ` default `[Future.State](/reference/java/util/concurrent/Future.State) | ` `[state](/reference/java/util/concurrent/Future#state())`() ` | ||\n| From interface ` `[java.lang.Runnable](/reference/java/lang/Runnable)` ` |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[run](/reference/java/lang/Runnable#run())`() ` When an object implementing interface `Runnable` is used to create a thread, starting the thread causes the object's `run` method to be called in that separately executing thread. | ||\n| From interface ` `[java.util.concurrent.Delayed](/reference/java/util/concurrent/Delayed)` ` |------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` 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| 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### isPeriodic\n\nAdded in [API level 9](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isPeriodic ()\n```\n\nReturns `true` if this task is periodic. A periodic task may\nre-run according to some schedule. A non-periodic task can be\nrun only once.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|----------------------------------------|\n| `boolean` | `true` if this task is periodic \u003cbr /\u003e |"]]