ScheduledThreadPoolExecutor.ScheduleAtFixedRate 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提交一个定期操作,该操作先在给定的初始延迟后启用,然后提交给定时间段;也就是说,执行将在之后 initialDelay
开始,然后 initialDelay + period
,然后 initialDelay + 2 * period
,等等。
[Android.Runtime.Register("scheduleAtFixedRate", "(Ljava/lang/Runnable;JJLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;", "GetScheduleAtFixedRate_Ljava_lang_Runnable_JJLjava_util_concurrent_TimeUnit_Handler")]
public virtual 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")>]
abstract member ScheduleAtFixedRate : Java.Lang.IRunnable * int64 * int64 * Java.Util.Concurrent.TimeUnit -> Java.Util.Concurrent.IScheduledFuture
override this.ScheduleAtFixedRate : Java.Lang.IRunnable * int64 * int64 * Java.Util.Concurrent.TimeUnit -> Java.Util.Concurrent.IScheduledFuture
参数
- command
- IRunnable
要执行的任务
- initialDelay
- Int64
延迟首次执行的时间
- period
- Int64
连续执行之间的句点
- unit
- TimeUnit
initialDelay 和句点参数的时间单位
返回
实现
- 属性
例外
注解
提交一个定期操作,该操作先在给定的初始延迟后启用,然后提交给定时间段;也就是说,执行将在之后 initialDelay
开始,然后 initialDelay + period
,然后 initialDelay + 2 * period
,等等。
任务执行序列无限期地继续,直到发生以下异常完成之一: <ul><li>任务是 Future#cancel 显式取消通过返回的未来。 <调用 li>方法 #shutdown
,并 #getContinueExistingPeriodicTasksAfterShutdownPolicy 策略,以确定是否在关闭后继续,或调用方法 #shutdownNow
;也会导致任务取消。 <li>执行任务将引发异常。 在这种情况下,调用 Future#get() get
返回的未来将引发 ExecutionException
,将保留异常作为其原因。 <将禁止 /ul> 后续执行。 对返回的未来进行后续调用 Future#isDone isDone()
将返回 true
。
如果此任务的任何执行时间超过其时间段,则后续执行可能会延迟启动,但不会同时执行。
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。