public class Timer extends AbstractTask
id
Constructor and Description |
---|
Timer(long delay,
long interval)
Creates a Timer object.
|
Timer(long delay,
long interval,
long maxRuns)
Creates a Timer object with limited number of running times.
|
Modifier and Type | Method and Description |
---|---|
long |
getDelay()
Gets the delay of this Timer.
|
long |
getInterval()
Gets the interval of this Timer.
|
long |
getMaxRuns()
Gets the number of maximum runs of this Timer.
|
void |
start(Context context)
Run all the services attached to the task.
|
addService, getId, getService, getServicesMap, pause, removeService, resume, stop
public Timer(long delay, long interval) throws SchedulingException
delay
- The initial delay.interval
- The interval between two task executions.SchedulingException
- When provided configuration values are invalid.public Timer(long delay, long interval, long maxRuns) throws SchedulingException
delay
- The initial delay.interval
- The interval between two task executions.maxRuns
- Number of times after which the timer will turn off.SchedulingException
- When provided configuration values are invalid.public void start(Context context) throws SchedulingException
context
- Ballerina context which runs the services.SchedulingException
- When there is a failure to stop the task after maximum number of runs specified.public long getInterval()
public long getDelay()
public long getMaxRuns()
Copyright © 2019 WSO2. All rights reserved.