T - 结果类型public class SimpleScheduler<T> extends Object
getResult() 可以获取调取时的执行结果| Modifier and Type | Class and Description |
|---|---|
static interface |
SimpleScheduler.Job<T>
带有结果计算的任务
用户实现此接口,通过 Runnable.run()实现定时任务的内容,定时任务每次执行或多次执行都可以产生一个结果这个结果存储在一个volatile的对象属性中,通过 SimpleScheduler.Job.getResult()来读取这一阶段的结果。 |
| Constructor and Description |
|---|
SimpleScheduler(SimpleScheduler.Job<T> job,
long period)
构造
|
SimpleScheduler(SimpleScheduler.Job<T> job,
long initialDelay,
long period,
boolean fixedRateOrFixedDelay)
构造
|
public SimpleScheduler(SimpleScheduler.Job<T> job, long period)
job - 任务period - 任务间隔,单位毫秒public SimpleScheduler(SimpleScheduler.Job<T> job, long initialDelay, long period, boolean fixedRateOrFixedDelay)
job - 任务initialDelay - 初始延迟,单位毫秒period - 执行周期,单位毫秒fixedRateOrFixedDelay - true表示fixedRate模式,false表示fixedDelay模式public T getResult()
Copyright © 2025. All rights reserved.