Annotation Interface Scheduled
Marks a method for automatic scheduled execution by the framework.
标记一个方法由框架自动调度执行。
The annotated method must be void and take no parameters.
It must be inside a @Service or other managed bean.
Tasks are automatically cancelled when the owning plugin is unloaded.
被注解的方法必须是 void 且无参数。
必须在 @Service 或其他托管 Bean 中使用。
当所属插件卸载时,任务会自动取消。
Usage example:
@Service
public class InterestService {
@Scheduled(period = 36000, async = true) // Every 30 minutes, async
public void distributeInterest() {
// Framework calls this automatically
}
}
- Since:
- 6.2.0
-
Optional Element Summary
Optional Elements
-
Element Details
-
delay
long delayInitial delay in ticks before first execution. Default: 0首次执行前的延迟tick数。默认:0
- Returns:
- delay in ticks
- Default:
0L
-
period
long periodRepeat interval in ticks. -1 = run once after delay. Default: -1重复间隔tick数。-1 = 延迟后只执行一次。默认:-1
- Returns:
- period in ticks
- Default:
-1L
-
async
boolean asyncRun on async thread instead of main server thread. Default: false在异步线程而非主线程上运行。默认:false
- Returns:
- true if async
- Default:
false
-