LoadBalancer class
A pool of runners, ordered by load.
Keeps a pool of runners, and allows running function through the runner with the lowest current load.
The number of pool runner entries is fixed when the pool is created. When the pool is closed, all runners are closed as well.
The load balancer is not reentrant. Executing a run function should not synchronously call methods on the load balancer.
- Implemented types
Constructors
-
LoadBalancer(Iterable<
Runner> runners) -
Create a load balancer backed by the Runners of
runners
.
Properties
Methods
-
close(
) → Future< void> -
Stop the runner.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run<
R, P> (FutureOr< R> function(P argument), P argument, {Duration? timeout, FutureOr<R> onTimeout()?, int load = 100}) → Future<R> -
Execute the command in the currently least loaded isolate.
override
-
runMultiple<
R, P> (int count, FutureOr< R> function(P argument), P argument, {Duration? timeout, FutureOr<R> onTimeout()?, int load = 100}) → List<Future< R> > -
Execute the same function in the least loaded
count
isolates. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited