0 Replies Latest reply on Jun 27, 2008 11:45 AM by Timo Roessner

    How to set a RMI client timeout?

    Timo Roessner Newbie

      Hey folks,

      i am having a hard time trying to figure out to set the client timeout for an RMI-client connected to a Stateless Session Bean.

      First i thought that this was not a Jboss specific question, but a RMI issue, that's why i asked here first: http://forum.java.sun.com/thread.jspa?threadID=5300931

      In the course of the thread above it turned out to be a Jboss issue (at least thats what i think...), since my client uses Jboss RMI libraries.

      Let me clarify the situation:

      - I have a RMI-client
      - This client connects to a Stateless Session Bean running within a Jboss 4.2.2 like this:

      Hashtable<String, String> props = new Hashtable<String, String>();
      props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.JndiLoginInitialContextFactory");
      props.put(Context.PROVIDER_URL, ....);
      props.put(Context.SECURITY_PRINCIPAL, ....);
      props.put(Context.SECURITY_CREDENTIALS, ....);
      Context ctx = new InitialContext(props);
      .... = ctx.lookup(....)
      

      - Now sometimes the methods the EJB calls take a looooong time
      - That's why i want my client to terminate the connection after a certain amount of time

      Now i tried to set all the timeouts mentioned in the thread above:



      RMI client Connect timeout:
      -Dsun.rmi.transport.proxy.connectTimeout=timeout. See http://java.sun.com/j2se/1.5.0/docs/guide/rmi/sunrmiproperties.html

      RMI client Handshake timeout:
      sun.rmi.transport.tcp.handshakeTimeout (see ditto).

      RMI client read timeout (for the response):
      sun.rmi.transport.tcp.responseTimeout (undocumented).


      But these timeouts are simply ignored by my client, so i think this is a Jboss issue...

      Any ideas?