3 Replies Latest reply on Jul 29, 2014 7:41 AM by EJP

    Control RMI lookup timeout

    2720244

      Dear all,

       

      I'd like to ask is there way to control the RMI lookup timeout through programming or network configurations.

       

      In a testing environment, I have purposely disconnect or plug out the cable between two testing servers to check the reliability. It took very long time for the RMI API to throw out java.rmi.ConnectException which used Naming.lookup(givenURL). I have tried to set system properties like sun.rmi.transport.tcp.handshakeTimeout, but it didn't take effect at all.

        • 1. Re: Control RMI lookup timeout
          EJP

          There isn't a way. The default connect timeout is determined by the operating system, usually around a minute. RMI doesn't provide a way to tune it. The system property you mention is a read timeout, as the documentation states, and it is for the RMI handshake, not the 3-way TCP handshake.

          • 2. Re: Control RMI lookup timeout
            2720244

            Dear EJP,

             

            Thanks for your answer. Can I put this way that you are saying the constraint of long timeout lies in the transport TCP layer instead of application RMI layer ?

             

            The reference I used is sun.rmi Properties of Oracle document. I didn't found it wait 1 minutes then threw the ConnectionException. Instead, it took around 19 to 21 seconds. However, it still long for me consider each lookup would take this duration.

             

            If the sun.rmi.transport.tcp.handshakeTimeout is not the correct one to use, then how about sun.rmi.transport.connectionTimeout ?

             

            Thanks again and looking forward to discuss with you.

            • 3. Re: Control RMI lookup timeout
              EJP

              > Can I put this way that you are saying the constraint of long timeout lies in the transport TCP layer instead of application RMI layer ?

               

              I'm not fond of this game where I give a clear answer and am then asked to agree to a partial rewording of it.

               

              > If the sun.rmi.transport.tcp.handshakeTimeout is not the correct one to use, then how about sun.rmi.transport.connectionTimeout ?

               

              No it isn't. Again I've already answered this by saying 'there isn't a way'. If you read the document you're citing you will see that for yourself.