Pip-Services-Commons-Dotnet
|
Timer that is triggered in equal time intervals. More...
Public Member Functions | |
FixedRateTimer () | |
Creates new instance of the timer with default parameters. More... | |
FixedRateTimer (Action task, int interval, int delay) | |
Creates new instance of the timer and sets its values. More... | |
void | Start () |
Starts the timer. More... | |
void | Restart () |
Restart the timer. More... | |
void | Stop () |
Stops the timer. More... | |
Properties | |
Action | Task [get, set] |
int | Delay [get, set] |
int | Interval [get, set] |
bool | IsStarted [get, private set] |
Private Attributes | |
Timer | _timer |
readonly object | _lock = new object() |
Timer that is triggered in equal time intervals.
It has summetric cross-language implementation and is often used by Pip.Services toolkit to perform periodic processing and cleanup in microservices.
See INotifiable
PipServices3.Commons.Run.FixedRateTimer.FixedRateTimer | ( | ) |
Creates new instance of the timer with default parameters.
PipServices3.Commons.Run.FixedRateTimer.FixedRateTimer | ( | Action | task, |
int | interval, | ||
int | delay | ||
) |
Creates new instance of the timer and sets its values.
task | (optional) a Notifiable object to call when timer is triggered. |
interval | (optional) an interval to trigger timer in milliseconds. |
delay | (optional) a delay before the first triggering in milliseconds. |
void PipServices3.Commons.Run.FixedRateTimer.Restart | ( | ) |
Restart the timer.
void PipServices3.Commons.Run.FixedRateTimer.Start | ( | ) |
Starts the timer.
Initially the timer is triggered after delay.After that it is triggered after interval until it is stopped.
void PipServices3.Commons.Run.FixedRateTimer.Stop | ( | ) |
Stops the timer.