Added in API level 9

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.

See also:

Summary

Public methods

abstract boolean isPeriodic()

Returns true if this task is periodic.

Inherited methods

abstract void run()

Sets this Future to the result of its computation unless it has been cancelled.

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()

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.

abstract long getDelay(TimeUnit unit)

Returns the remaining delay associated with this object, in the given time unit.

abstract int compareTo(Delayed o)

Compares this object with the specified object for order.

Public methods

isPeriodic

Added in API level 9
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