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.

Implemented types

Constructors

LoadBalancer(Iterable<Runner> runners)
Create a load balancer backed by the Runners of runners.

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
The number of runners currently in the pool.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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<FutureOr<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

Static Methods

create(int size, Future<Runner> createRunner()) Future<LoadBalancer>
Asynchronously create size runners and create a LoadBalancer of those.