RunnableScheduledFuture
Stay organized with collections
Save and categorize content based on your preferences.
A ScheduledFuture
that is Runnable
. Successful
execution of the run
method causes completion of the
Future
and allows access to its results.
Public Method Summary
abstract
boolean
|
isPeriodic()
Returns true if this task is periodic.
|
Inherited Method Summary
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.
|
From interface
java.util.concurrent.Future
abstract
boolean
|
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task.
|
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.
|
Public Methods
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
true
if this task is periodic
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-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 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eRunnableScheduledFuture\u003c/code\u003e combines the capabilities of \u003ccode\u003eRunnableFuture\u003c/code\u003e and \u003ccode\u003eScheduledFuture\u003c/code\u003e, allowing tasks to be executed on a schedule.\u003c/p\u003e\n"],["\u003cp\u003eExecuting the \u003ccode\u003erun\u003c/code\u003e method marks the \u003ccode\u003eFuture\u003c/code\u003e as complete and makes the results accessible.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eisPeriodic()\u003c/code\u003e method indicates whether the task is scheduled for repeated execution or a single run.\u003c/p\u003e\n"],["\u003cp\u003eThis interface inherits methods from \u003ccode\u003eRunnableFuture\u003c/code\u003e, \u003ccode\u003eScheduledFuture\u003c/code\u003e, and other related interfaces, providing functionalities like cancellation, result retrieval, and delay management.\u003c/p\u003e\n"]]],[],null,["# RunnableScheduledFuture\n\npublic interface **RunnableScheduledFuture** implements [RunnableFuture](../../../../reference/java/util/concurrent/RunnableFuture.html)\\\u003cV\\\u003e [ScheduledFuture](../../../../reference/java/util/concurrent/ScheduledFuture.html)\\\u003cV\\\u003e \nA [ScheduledFuture](../../../../reference/java/util/concurrent/ScheduledFuture.html) that is [Runnable](../../../../reference/java/lang/Runnable.html). Successful\nexecution of the `run` method causes completion of the\n`Future` and allows access to its results. \n\n##### See Also\n\n- [FutureTask](../../../../reference/java/util/concurrent/FutureTask.html)\n- [Executor](../../../../reference/java/util/concurrent/Executor.html) \n\n### Public Method Summary\n\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [isPeriodic](../../../../reference/java/util/concurrent/RunnableScheduledFuture.html#isPeriodic())() Returns `true` if this task is periodic. |\n\n### Inherited Method Summary\n\nFrom interface [java.util.concurrent.RunnableFuture](../../../../reference/java/util/concurrent/RunnableFuture.html) \n\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [run](../../../../reference/java/util/concurrent/RunnableFuture.html#run())() Sets this Future to the result of its computation unless it has been cancelled. |\n\nFrom interface [java.lang.Runnable](../../../../reference/java/lang/Runnable.html) \n\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [run](../../../../reference/java/lang/Runnable.html#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\nFrom interface [java.util.concurrent.Future](../../../../reference/java/util/concurrent/Future.html) \n\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [cancel](../../../../reference/java/util/concurrent/Future.html#cancel(boolean))(boolean mayInterruptIfRunning) Attempts to cancel execution of this task. |\n| abstract V | [get](../../../../reference/java/util/concurrent/Future.html#get(long,%20java.util.concurrent.TimeUnit))(long timeout, [TimeUnit](../../../../reference/java/util/concurrent/TimeUnit.html) unit) Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. |\n| abstract V | [get](../../../../reference/java/util/concurrent/Future.html#get())() Waits if necessary for the computation to complete, and then retrieves its result. |\n| abstract boolean | [isCancelled](../../../../reference/java/util/concurrent/Future.html#isCancelled())() Returns `true` if this task was cancelled before it completed normally. |\n| abstract boolean | [isDone](../../../../reference/java/util/concurrent/Future.html#isDone())() Returns `true` if this task completed. |\n\nFrom interface [java.util.concurrent.Delayed](../../../../reference/java/util/concurrent/Delayed.html) \n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract long | [getDelay](../../../../reference/java/util/concurrent/Delayed.html#getDelay(java.util.concurrent.TimeUnit))([TimeUnit](../../../../reference/java/util/concurrent/TimeUnit.html) unit) Returns the remaining delay associated with this object, in the given time unit. |\n\nFrom interface [java.lang.Comparable](../../../../reference/java/lang/Comparable.html) \n\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract int | [compareTo](../../../../reference/java/lang/Comparable.html#compareTo(T))([Delayed](../../../../reference/java/util/concurrent/Delayed.html) o) Compares this object with the specified object for order. |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**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##### Returns\n\n- `true` if this task is periodic"]]