restart method
Restarts the isolate manager by stopping and restarting all isolates.
This method:
- Pauses all running isolates
- Clears the queue state
- Creates new isolates with the original configuration
This is useful when you need to:
- Reset the isolate's internal state
- Recover from error conditions
- Apply new configuration changes
Note: Any pending tasks in the queue will be lost during restart. Throws IsolateException if the manager is already stopped.
Implementation
Future<void> restart() async {
if (_streamController.isClosed) {
throw const IsolateException(
'Cannot restart IsolateManager: Instance is already stopped. Create a new instance to perform operations.',
);
}
await pause();
await start();
}