stop method

void stop()

Throws if there're pending jobs or requests

Implementation

void stop() {
  for (var i in _isolates) {
    i.kill();
    for (var c in jobCompleters.values) {
      if (!c.isCompleted) {
        c.completeError('Isolate pool stopped upon request, cancelling jobs');
      }
    }
    jobCompleters.clear();

    for (var c in creationCompleters.values) {
      if (!c.isCompleted) {
        c.completeError(
            'Isolate pool stopped upon request, cancelling instance creation requests');
      }
    }
    creationCompleters.clear();

    for (var c in _requestCompleters.values) {
      if (!c.isCompleted) {
        c.completeError(
            'Isolate pool stopped upon request, cancelling pending request');
      }
    }
    _requestCompleters.clear();
    for (var rPort in receivePorts) {
      rPort.close(); // Issue #3
    }
  }

  _state = IsolatePoolState.stoped;
}