I am using RMI in my project, we have a RMI Server and RMI Client. Client is in webapplication, so we are storing server reference in common constants.
I want to know, how expensive is it to do lookup for server in registry everytime we need server instance. or is it better to do look up once and store it in some constant.
If i store it in constant then problem begins if RMI server is restarted. because that constant variable holds old reference and it throws java.rmi.NoSuchObjectException: no such object in table
Any Inputs are welcome.