IScheduledExecutorService.ScheduleAtFixedRate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Submits a periodic action that becomes enabled first after the
given initial delay, and subsequently with the given period;
that is, executions will commence after
initialDelay
, then initialDelay + period
, then
initialDelay + 2 * period
, and so on.
[Android.Runtime.Register("scheduleAtFixedRate", "(Ljava/lang/Runnable;JJLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;", "GetScheduleAtFixedRate_Ljava_lang_Runnable_JJLjava_util_concurrent_TimeUnit_Handler:Java.Util.Concurrent.IScheduledExecutorServiceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Util.Concurrent.IScheduledFuture? ScheduleAtFixedRate (Java.Lang.IRunnable? command, long initialDelay, long period, Java.Util.Concurrent.TimeUnit? unit);
[<Android.Runtime.Register("scheduleAtFixedRate", "(Ljava/lang/Runnable;JJLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;", "GetScheduleAtFixedRate_Ljava_lang_Runnable_JJLjava_util_concurrent_TimeUnit_Handler:Java.Util.Concurrent.IScheduledExecutorServiceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member ScheduleAtFixedRate : Java.Lang.IRunnable * int64 * int64 * Java.Util.Concurrent.TimeUnit -> Java.Util.Concurrent.IScheduledFuture
Parameters
- command
- IRunnable
the task to execute
- initialDelay
- Int64
the time to delay first execution
- period
- Int64
the period between successive executions
- unit
- TimeUnit
the time unit of the initialDelay and period parameters
Returns
a ScheduledFuture representing pending completion of
the series of repeated tasks. The future's Future#get() get()
method will never return normally,
and will throw an exception upon task cancellation or
abnormal termination of a task execution.
- Attributes
Exceptions
if the task cannot be scheduled for execution
if command is null
if period less than or equal to zero
Remarks
Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is, executions will commence after initialDelay
, then initialDelay + period
, then initialDelay + 2 * period
, and so on.
The sequence of task executions continues indefinitely until one of the following exceptional completions occur: <ul> <li>The task is Future#cancel explicitly cancelled via the returned future. <li>The executor terminates, also resulting in task cancellation. <li>An execution of the task throws an exception. In this case calling Future#get() get
on the returned future will throw ExecutionException
, holding the exception as its cause. </ul> Subsequent executions are suppressed. Subsequent calls to Future#isDone isDone()
on the returned future will return true
.
If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.