FixedRateTimer class
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
Example
class MyComponent {
FixedRateTimer timer = new FixedRateTimer(() { cleanup }, 60000);
...
void open(String correlationId, callback (dynamic err)) {
...
timer.start();
...
}
void close(String correlationId, callback (dynamic err)) {
...
timer.stop();
...
}
void cleanup() {
...
}
...
}
- Implemented types
Constructors
- FixedRateTimer([dynamic taskOrCallback, int interval int delay ])
- Creates new instance of the timer and sets its values. [...]
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
close(
String correlationId) → Future -
Closes the timer. [...]
override
-
getCallback(
) → dynamic Function() - Gets the callback function that is called when this timer is triggered. [...]
-
getDelay(
) → int - Gets initial delay before the timer is triggered for the first time. [...]
-
getInterval(
) → int - Gets periodic timer triggering interval. [...]
-
getTask(
) → INotifiable - Gets the INotifiable object that receives notifications from this timer. [...]
-
isStarted(
) → bool - Checks if the timer is started. [...]
-
setCallback(
dynamic value()) → void - Sets the callback function that is called when this timer is triggered. [...]
-
setDelay(
int value) → void - Sets initial delay before the timer is triggered for the first time. [...]
-
setInterval(
int value) → void - Sets periodic timer triggering interval. [...]
-
setTask(
INotifiable value) → void - Sets a new INotifiable object to receive notifications from this timer. [...]
-
start(
) → void - Starts the timer. [...]
-
stop(
) → void - Stops the timer. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited