IsolateSpawner class abstract

Starts, watches and stops the server isolates (all but the main one). DoxIsolate starts them in the group of the main isolate. DoxIsolateGroups starts each one in its own isolate group.

Internal: Dox().startServer() picks one. Apps do not use it.

Implementers

Constructors

IsolateSpawner()

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 pair
hashCode → int
The hash code for this object.
no setterinherited
isolates → Map<int, Isolate>
the running isolates, isolate id -> isolate
final
maxEarlyExits → int?
How many times in a row an isolate may end before it serves, until it is not started again. Null: no limit.
no setter
ready → Map<int, Completer<bool>>
isolate id -> true when it serves, false when it ended before that
final
receivePorts → Map<int, List<ReceivePort>>
final
restartDelay ↔ Duration
wait before a dead isolate is started again, so a crash loop does not burn the CPU
getter/setter pair
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
final
stopped ↔ bool
getter/setter pair

Methods

killAll({bool now = false}) → void
kill all the isolate. With now they stop at once, not at their next event.
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
spawn(int count) → Future<void>
start the isolates 2 to count
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.
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.
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.
stopServing(Duration timeout) → Future<void>
The first part of stopAll: every isolate that serves stops gracefully. The isolates are not killed.
toString() → String
A string representation of this object.
inherited

Operators

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