byte[] r = new byte[ response_header.message_size ]; int n = 0; reading: while (n < r.length)
byte [] r; if (orb instanceof Functional_ORB)
  public synchronized binaryReply submit() throws ForwardRequest  {    gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();    header.setBigEndian(Big_endian);    // The byte order will be Big Endian by default.    header.message_type = gnu.CORBA.GIOP.MessageHeader.REQUEST;    header.version = useVersion(ior.Internet.version);    RequestHeader rh = header.create_request_header();    rh.operation = m_operation;    rh.object_key = ior.key;    // Update interceptor.    m_rqh = rh;    if (m_interceptor != null)      m_interceptor.send_request(m_info);    // Prepare the submission.    cdrBufOutput request_part = new cdrBufOutput();    request_part.setOffset(header.getHeaderSize());    request_part.setVersion(header.version);    request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));    request_part.setOrb(orb);    request_part.setBigEndian(header.isBigEndian());    // This also sets the stream encoding to the encoding, specified    // in the header.    rh.write(request_part);    if (m_args != null && m_args.count() > 0)      {        write_parameters(header, request_part);        if (m_parameter_buffer != null)          throw new BAD_INV_ORDER("Please either add parameters or " +            "write them into stream, but not both " + "at once."                                 );      }    if (m_parameter_buffer != null)      {        write_parameter_buffer(header, request_part);      }    // Now the message size is available.    header.message_size = request_part.buffer.size();    Socket socket = null;    java.lang.Object key = ior.Internet.host + ":" + ior.Internet.port;    synchronized (SocketRepository.class)      {        socket = SocketRepository.get_socket(key);      }    try      {        long pause = PAUSE_INITIAL;        if (socket == null)          {            // The BindException may be thrown under very heavy parallel            // load. For some time, just wait, exceptiong the socket to free.            Open:            for (int i = 0; i < PAUSE_STEPS; i++)              {                try                  {                    socket = new Socket(ior.Internet.host, ior.Internet.port);                    break Open;                  }                catch (BindException ex)                  {                    try                      {                        // Expecting to free a socket via finaliser.                        System.gc();                        Thread.sleep(pause);                        pause = pause * 2;                        if (pause > PAUSE_MAX)                          pause = PAUSE_MAX;                      }                    catch (InterruptedException iex)                      {                      }                  }              }          }        if (socket == null)          throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port +                                 " in use"                                );        socket.setKeepAlive(true);        OutputStream socketOutput = socket.getOutputStream();        // Write the message header.        header.write(socketOutput);        // Write the request header and parameters (if present).        request_part.buffer.writeTo(socketOutput);        socketOutput.flush();        if (!socket.isClosed())          {            MessageHeader response_header = new MessageHeader();            InputStream socketInput = socket.getInputStream();            response_header.read(socketInput);            byte[] r = new byte[ response_header.message_size ];            int n = 0;            reading:            while (n < r.length)              {                n += socketInput.read(r, n, r.length - n);              }            return new binaryReply(orb, response_header, r);          }        else          return EMPTY;      }    catch (IOException io_ex)      {        MARSHAL m =          new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" +                      ior.Internet.port, 10000 + ior.Internet.port,                      CompletionStatus.COMPLETED_NO                     );        m.initCause(io_ex);        throw m;      }    finally      {        try          {            if (socket != null && !socket.isClosed())              {                socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS);                SocketRepository.put_socket(key, socket);              }          }        catch (IOException scx)          {            InternalError ierr = new InternalError();            ierr.initCause(scx);            throw ierr;          }      }  }