This discussion is archived
1 Reply Latest reply: Sep 5, 2011 3:55 PM by EJP RSS

Maintain client state in server

886274 Newbie
Currently Being Moderated
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
    EJP Guru
    Currently Being Moderated
    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.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points