/[classpath]/classpath/gnu/CORBA/gnuRequest.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/gnuRequest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by audriusa, Tue Oct 4 17:58:15 2005 UTC revision 1.14 by audriusa, Fri Oct 21 16:15:32 2005 UTC
# Line 722  public class gnuRequest extends Request Line 722  public class gnuRequest extends Request
722     *     *
723     * @return the server response in binary form.     * @return the server response in binary form.
724     */     */
725  public synchronized binaryReply submit() throws ForwardRequest    public synchronized binaryReply submit()
726        throws ForwardRequest
727    {    {
728      gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();      gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();
729    
# Line 754  public synchronized binaryReply submit() Line 755  public synchronized binaryReply submit()
755      // This also sets the stream encoding to the encoding, specified      // This also sets the stream encoding to the encoding, specified
756      // in the header.      // in the header.
757      rh.write(request_part);      rh.write(request_part);
758        
759      if (m_args != null && m_args.count() > 0)      if (m_args != null && m_args.count() > 0)
760        {        {
761          write_parameters(header, request_part);          write_parameters(header, request_part);
762    
763          if (m_parameter_buffer != null)          if (m_parameter_buffer != null)
764            throw new BAD_INV_ORDER("Please either add parameters or " +            throw new BAD_INV_ORDER("Please either add parameters or "
765              "write them into stream, but not both " + "at once."              + "write them into stream, but not both " + "at once.");
           );  
766        }        }
767    
768      if (m_parameter_buffer != null)      if (m_parameter_buffer != null)
# Line 790  public synchronized binaryReply submit() Line 790  public synchronized binaryReply submit()
790            {            {
791              // The BindException may be thrown under very heavy parallel              // The BindException may be thrown under very heavy parallel
792              // load. For some time, just wait, exceptiong the socket to free.              // load. For some time, just wait, exceptiong the socket to free.
793              Open:              Open: for (int i = 0; i < PAUSE_STEPS; i++)
             for (int i = 0; i < PAUSE_STEPS; i++)  
794                {                {
795                  try                  try
796                    {                    {
797                      socket = new Socket(ior.Internet.host, ior.Internet.port);                      if (orb instanceof Functional_ORB)
798                          socket = ((Functional_ORB) orb).socketFactory.createClientSocket(
799                            ior.Internet.host, ior.Internet.port);
800                        else
801                          socket = new Socket(ior.Internet.host, ior.Internet.port);
802                      break Open;                      break Open;
803                    }                    }
804                  catch (BindException ex)                  catch (BindException ex)
# Line 817  public synchronized binaryReply submit() Line 820  public synchronized binaryReply submit()
820            }            }
821    
822          if (socket == null)          if (socket == null)
823            throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port +            throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port
824              " in use"              + " in use");
           );  
825          socket.setKeepAlive(true);          socket.setKeepAlive(true);
826    
827          OutputStream socketOutput = socket.getOutputStream();          OutputStream socketOutput = socket.getOutputStream();
# Line 836  public synchronized binaryReply submit() Line 838  public synchronized binaryReply submit()
838              MessageHeader response_header = new MessageHeader();              MessageHeader response_header = new MessageHeader();
839              InputStream socketInput = socket.getInputStream();              InputStream socketInput = socket.getInputStream();
840              response_header.read(socketInput);              response_header.read(socketInput);
841                
842              byte [] r;              byte[] r;
843              if (orb instanceof Functional_ORB)              if (orb instanceof Functional_ORB)
844                {                {
845                  Functional_ORB fo = (Functional_ORB) orb;                  Functional_ORB fo = (Functional_ORB) orb;
846                  r =response_header.readMessage(socketInput, socket,                  r = response_header.readMessage(socketInput, socket,
847                    fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING);                    fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING);
848                }                }
849              else              else
850                r = response_header.readMessage(socketInput, null, 0, 0);                r = response_header.readMessage(socketInput, null, 0, 0);
851                  
852              return new binaryReply(orb, response_header, r);              return new binaryReply(orb, response_header, r);
853            }            }
854          else          else
# Line 854  public synchronized binaryReply submit() Line 856  public synchronized binaryReply submit()
856        }        }
857      catch (IOException io_ex)      catch (IOException io_ex)
858        {        {
859          COMM_FAILURE m =          COMM_FAILURE m = new COMM_FAILURE("Unable to open a socket at "
860            new COMM_FAILURE("Unable to open a socket at " + ior.Internet.host + ":" +            + ior.Internet.host + ":" + ior.Internet.port, 0xC9,
861              ior.Internet.port, 0xC9,            CompletionStatus.COMPLETED_NO);
             CompletionStatus.COMPLETED_NO  
           );  
862          m.initCause(io_ex);          m.initCause(io_ex);
863          throw m;          throw m;
864        }        }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26