ProcessGroup<I, O, CR> class

Spawn multiple processes and automatically distribute the workload among them. Utility class – wrapper around Process.

Implemented types

Properties

hashCode int
The hash code for this object.
no setterinherited
processingIsComplete Future<void>
Returns null when all processing is completed.
no setteroverride
processInput Future<O> Function(I input, CR commonResourceRecord)
Callback used for processing individual inputs sent to the spawned process.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
setupProcess Future<CR> Function()
Generate common resources required to process individual inputs. The outputs are passed to all calls of processInput.
final
shutdownProcess Future<void> Function(CR commonResourceRecord)
Callback used for cleaning up any resources generated in setupProcess after processing is done.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
process(I input) Future<O>
Process the given input in a the spawned process.
override
shutdownNow() Future<void>
Kill the spawned process immediately irrespective of weather the current inputs are processed or not.
override
shutdownOnCompletion() Future<void>
Kill the spawned process after processing current items in queue.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

boot<I, O, CR>(Future<CR> setupProcess(), Future<O> processInput(I input, CR commonResourceRecord), Future<void> shutdownProcess(CR commonResourceRecord), [int? numberOfProcesses]) Future<ProcessGroup<I, O, CR>>
Boots up a new ProcessGroup instance.