Annotation Interface ScheduledTask
Annotation used to mark a method as a scheduled task. This annotation is part of the Bring Framework's scheduling
support, allowing the method to be automatically invoked at specified intervals.
The annotated method must adhere to the requirements for a scheduled task method, including having no parameters and a void return type.
You can customize the scheduling behavior by providing values for the value
, initialDelay
,
period
, and timeUnit
attributes. If not specified, the default values will be used.
Usage Example:
@Service
public class MyScheduledService {
@ScheduledTask(value = "myTask", initialDelay = 1000, period = 5000, timeUnit = TimeUnit.MILLISECONDS)
public void myScheduledMethod() {
// Task logic
}
}
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionlong
The initial delay before the first execution of the task, in milliseconds.long
The fixed rate between consecutive executions of the task, in milliseconds.The time unit for the initial delay and period attributes.The name of the scheduled task.
-
Element Details
-
value
String valueThe name of the scheduled task. If not specified, the method name will be used as the task name.- Returns:
- the name of the scheduled task
- Default:
""
-
initialDelay
long initialDelayThe initial delay before the first execution of the task, in milliseconds.- Returns:
- the initial delay in milliseconds
- Default:
1000L
-
period
long periodThe fixed rate between consecutive executions of the task, in milliseconds.- Returns:
- the period between executions in milliseconds
- Default:
5000L
-
timeUnit
TimeUnit timeUnitThe time unit for the initial delay and period attributes. Defaults toTimeUnit.MILLISECONDS
.- Returns:
- the time unit for the initial delay and period
- Default:
MILLISECONDS
-