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                 try {
 300                     conn.close();
 301                 } catch (Exception ex) {}
 302                 if (e instanceof RemoteException) {
 303                     throw (RemoteException) e;
 304                 } else {
 305                     throw new ConnectIOException(
 306                         "error during JRMP connection establishment", e);
 307                 }
 308             }
 309         } else {
 310             try {
 311                 conn = multiplexer.openConnection();
 312             } catch (IOException e) {
 313                 synchronized (this) {
 314                     usingMultiplexer = false;
 315                     multiplexer = null;
 316                 }
 317                 throw new ConnectIOException(
 318                     "error opening virtual connection " +
 319                     "over multiplexed connection", e);
 320             }
 321         }
 322         return conn;
 323     }
 324 
 325     /**
 326      * Free the connection generated by this channel.
 327      * @param conn The connection
 328      * @param reuse If true, the connection is in a state in which it