1 Reply Latest reply on Sep 5, 2011 10:55 PM by EJP

    Maintain client state in server

      Can I maintain state for a specific client in rmi/jrmp server object (like ejb stateful session bean)?
      Thank you, Bobic.

      Edited by: 883271 on Sep 5, 2011 9:34 AM
        • 1. Re: Maintain client state in server
          Yes, there are two ways (at least) to do that:

          1. Map<String, ClientData> where String is the result of RemoteServer.getClientHost(). Use this in the case where there is only one instance of your remote object.

          2. Allocate a remote object instance per client. I call this the Remote Session pattern. You make it so that the thing you look up in the Registry is really a factory, and your clients call a method on the factory to get their own instance, which is basically a remote session.