1 Reply Latest reply on Nov 2, 2003 6:08 PM by Juha Lindfors

    RMI reconnect strategy?

    gorano Newbie

      Hi all,

      I try to find a "pattern" for RMI reconnect. hopefully someone here can bring some good ideas to this issue.

      I have an application sitting on a dodgy network (losing connection to JBoss now and then) and I want the application to recover after connection failure or a JBoss reeboot.

      To make things go faster I only look up the RemoteInterface once in the constructor. This means that I have an invalid object after a JBoss reeboot, timeout or whatever.

      What is the best strategy to reconnect? What do I have to look up again (IC, RemoteHome)?

      Shoul I have a thread that tests the connection in intervalls? How to test in that case?

      Or should i reconnect only after RemoteException on method call and try the method again (I am doing this today, but the code looks ugly).

      All tips and tricks are welcome!

      Thanks in advance


        • 1. Re: RMI reconnect strategy?
          Juha Lindfors Master

          Basically this is already done in HARMIClient.java, what you need is to add a timeout interval between reattempts (since it seems you're working in a single node mode) rather than trying an immediate failover to another node. You could probably introduce the time interval in your own load balancer implementation.

          -- Juha