src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java

Print this page




 279                      * connection.  NOTE: this timeout, if configured to a
 280                      * finite duration, places an upper bound on the time
 281                      * that a remote method call is permitted to execute.
 282                      */
 283                     try {
 284                         /*
 285                          * If socket factory had set a non-zero timeout on its
 286                          * own, then restore it instead of using the property-
 287                          * configured value.
 288                          */
 289                         sock.setSoTimeout((originalSoTimeout != 0 ?
 290                                            originalSoTimeout :
 291                                            responseTimeout));
 292                     } catch (Exception e) {
 293                         // if we fail to set this, ignore and proceed anyway
 294                     }
 295 
 296                     out.flush();
 297                 }
 298             } catch (IOException e) {
 299                 if (e instanceof RemoteException)
 300                     throw (RemoteException) e;
 301                 else







 302                     throw new ConnectIOException(
 303                         "error during JRMP connection establishment", e);
 304             }

 305         } else {
 306             try {
 307                 conn = multiplexer.openConnection();
 308             } catch (IOException e) {
 309                 synchronized (this) {
 310                     usingMultiplexer = false;
 311                     multiplexer = null;
 312                 }
 313                 throw new ConnectIOException(
 314                     "error opening virtual connection " +
 315                     "over multiplexed connection", e);
 316             }
 317         }
 318         return conn;
 319     }
 320 
 321     /**
 322      * Free the connection generated by this channel.
 323      * @param conn The connection
 324      * @param reuse If true, the connection is in a state in which it




 279                      * connection.  NOTE: this timeout, if configured to a
 280                      * finite duration, places an upper bound on the time
 281                      * that a remote method call is permitted to execute.
 282                      */
 283                     try {
 284                         /*
 285                          * If socket factory had set a non-zero timeout on its
 286                          * own, then restore it instead of using the property-
 287                          * configured value.
 288                          */
 289                         sock.setSoTimeout((originalSoTimeout != 0 ?
 290                                            originalSoTimeout :
 291                                            responseTimeout));
 292                     } catch (Exception e) {
 293                         // if we fail to set this, ignore and proceed anyway
 294                     }
 295 
 296                     out.flush();
 297                 }
 298             } catch (IOException e) {
 299                 if (e instanceof RemoteException) {
 300                     throw (RemoteException) e;
 301                 } else {
 302                     if (conn != null
 303                             && e instanceof java.net.SocketTimeoutException)
 304                     {
 305                         try {
 306                             conn.close();
 307                         } catch (Exception ex) {}
 308                     }
 309                     throw new ConnectIOException(
 310                         "error during JRMP connection establishment", e);
 311                 }
 312             }
 313         } else {
 314             try {
 315                 conn = multiplexer.openConnection();
 316             } catch (IOException e) {
 317                 synchronized (this) {
 318                     usingMultiplexer = false;
 319                     multiplexer = null;
 320                 }
 321                 throw new ConnectIOException(
 322                     "error opening virtual connection " +
 323                     "over multiplexed connection", e);
 324             }
 325         }
 326         return conn;
 327     }
 328 
 329     /**
 330      * Free the connection generated by this channel.
 331      * @param conn The connection
 332      * @param reuse If true, the connection is in a state in which it