6 Replies Latest reply on Apr 23, 2011 1:42 PM by Ron Sigal

    client side socket timeout

    Mayank Mittal Novice

      Hello ,

           I've an EJB3 application running on Jboss Server and a RMI client to invoke its methods. No i've an issue in setting up time out for specific calls.

      I want to set up the time out to 1 sec. I've used follwing contest properties to set up the timeout but are not working.


      private static Properties getContextProperties ()


              final Properties props = new Properties();

              props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

              props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

              props.put("jnp.sotimeout", "1000");

              props.put("jsun.rmi.transport.tcp.readTimeout", "10");

              props.put("socketTimeout", "1000");       

              props.put("jnp.timeout", "1000");

              props.put("timeout", "1000");



              if (mActiveNetworkAddress != null)


                  props.put(NamingContext.JNP_LOCAL_ADDRESS, mActiveNetworkAddress);




              // for HA-JNDI lookup

               props.put(Context.PROVIDER_URL, "Server01:1100,Server02:1100");

              props.put(NamingContext.JNP_DISABLE_DISCOVERY, "true");



              return props;


        • 1. client side socket timeout
          Mayank Mittal Novice

          Forget to mention:

             Jboss AS : 4.2.3 GA

             Jboss Remoting: 2.4.0 SP1

          • 2. client side socket timeout
            Ron Sigal Master

            Hi Mayank,


            Remoting has a per invocation timeout facility, but I don't believe there's any way to access it using an EJB3 proxy.  The best you can do would be to set a global timeout in $JBOSS_HOME/server/$CONFIG/deploy/ejb3.deployer/META-INF/jboss-service.xml:


               <mbean code="org.jboss.remoting.transport.Connector"



                  <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873/?timeout=xyz</attribute>  <<=== here

                  <attribute name="Configuration">


                        <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>






            • 3. client side socket timeout
              Mayank Mittal Novice

              Hello Ron,

                  Thanks for your reply. But this solution is not going to help me. As what we exactly want is to configure the socket time out for a particular method of  ClusteredStatelessProxy.

                  As what we have number of calls that requires long time to get processed, but we have a heartbeat sort of call that need to be timeout if the server is not available, and this detection is to be done ASAP, let say in 200 ms.

              • 4. client side socket timeout
                Ron Sigal Master

                Hi Mayank,


                Sorry I couldn't help you.  You might want to take a look at the byteman project (http://www.jboss.org/byteman), which lets you inject code into existing code.  I know very little about it, but it sounds like it might be useful.


                Good luck,


                • 5. client side socket timeout
                  Mayank Mittal Novice

                  Hello  Ron,

                     Thanks for your reply ... Not an issue... I know we are trying something for which JBR is not designed for. We've to go for some out-of-the box solution... Thanks for suggesting Byteman project...