DoxIsolateGroups class

Like DoxIsolate, but every server isolate runs in its own isolate group, so it has its own heap and its own garbage collector. Used when CoreFlags.isolateGroups is on.

The isolate starts the main() of the app again from snapshot. In startServer() it sees it is a group worker (see GroupIdentity), asks this isolate for its ports and serves requests. So the routes, config and providers are built by main() in each group, and nothing but simple data crosses between groups. The compute pool is not shared: each group has its own.

Inheritance

Constructors

DoxIsolateGroups(Uri snapshot)

Properties

firstStart ↔ bool
True while spawn waits for the first start of the isolates. An isolate that ends then is not started again: spawn fails.
getter/setter pairinherited
hashCode → int
The hash code for this object.
no setterinherited
isolates → Map<int, Isolate>
the running isolates, isolate id -> isolate
finalinherited
maxEarlyExits → int?
a group that can not start is not tried for ever
no setteroverride
ready → Map<int, Completer<bool>>
isolate id -> true when it serves, false when it ended before that
finalinherited
receivePorts → Map<int, List<ReceivePort>>
finalinherited
restartDelay ↔ Duration
wait before a dead isolate is started again, so a crash loop does not burn the CPU
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendPorts → Map<int, SendPort>
isolate id -> the port to send the stop message to
finalinherited
snapshot → Uri
the file to start, see SnapshotLocator
final
stopped ↔ bool
getter/setter pairinherited

Methods

killAll({bool now = false}) → void
kill all the isolate. With now they stop at once, not at their next event.
inherited
killIsolates({bool now = false}) → void
killAll for the isolates and their ports only. The counter, the session store and the bus of this isolate stay as they are.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
spawn(int count) → Future<void>
create the isolates 2 to count
override
spawnOne(int isolateId) → Future<void>
create a thread. when it dies, the error is printed and the isolate is started again. the main isolate (id 1) is not watched here: if it dies the process exits with a non-zero code, and your supervisor (docker, systemd) restarts it.
inherited
start(int isolateId, SendPort control, SendPort error, SendPort exit, List<ReceivePort> ports) → Future<Isolate>
Start the isolate isolateId. It sends its stop port to control, its errors to error and tells exit when it ends. ports are closed when the isolate ends.
override
stopAll(Duration timeout) → Future<void>
Stop every isolate gracefully: each stops taking connections, lets open requests finish (up to timeout) and runs shutdown() of its providers. Isolates still busy after that are killed.
inherited
stopServing(Duration timeout) → Future<void>
The first part of stopAll: every isolate that serves stops gracefully. The isolates are not killed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

startTimeout ↔ Duration
The most time the isolates have to serve after their start, all together. main() of the app and the boot of the providers run in this time. After it, spawn fails.
getter/setter pair