IsolateSystemServiceRequestHandler(SystemServiceManager serviceManager, Isolate clientIsolate) {

    this.serviceIsolate = Isolate.currentIsolate();
    this.clientIsolate = clientIsolate;
    this.serviceManager = serviceManager;

    Link sendLink = Link.newLink(serviceIsolate, clientIsolate);
    Link receiveLink = Link.newLink(clientIsolate, serviceIsolate);
    this.sendReceiveLinks = new SystemServiceConnectionLinks(sendLink, receiveLink);

    serviceRequestProtocol = new SystemServiceRequestProtocolAMS(this);
  }
  public SystemServiceConnectionLinks onServiceRequest(String serviceID) {
    requestedService = serviceManager.getService(serviceID);
    if (requestedService == null) {
      return null;
    }

    Link serviceToClient = Link.newLink(serviceIsolate, clientIsolate);
    Link clientToService = Link.newLink(clientIsolate, serviceIsolate);
    SystemServiceConnectionLinks connectionLinks =
        new SystemServiceConnectionLinks(serviceToClient, clientToService);

    return connectionLinks;
  }
    public void run() {
      SystemServiceConnectionLinks requestLinks = requestHandler.getSendReceiveLinks();

      Link receiveLink = requestLinks.getReceiveLink();

      try {
        while (true) {
          LinkMessage msg = receiveLink.receive();
          requestHandler.handleServiceRequest();
        }
      } catch (ClosedLinkException cle) {
        // do nothing
      } catch (InterruptedIOException iioe) {
        requestLinks.close();
      } catch (IOException ioe) {
        requestLinks.close();
      }
    }