Discussions

General J2EE: How do I save client state using RMI ?

  1. How do I save client state using RMI ? (4 messages)

    Hi, I would like to know if its possible to save client info on the server in an RMI client-server based app. (not using stateful ejbs here). Basically this means the server needs to know some client id info. I tried using the getClientHost() method of the UnicastRemoteObject, but it only gives me the ip and port of the client - and thats not good enough. For example I got the same values here if I had two client threads (two remote objects) in the same client VM.

    I searched some faq, javaworld and the tutorials at sun without success.

    Thanks in advance for all possible hints, code or pointers on the net.

    /Lukas
  2. you can presist this state data somewhere
  3. Eahhh ? The problem is not weather to write data to disk, database or just cache it - i still need to get the client id somehow.
  4. Then what is the problem...
  5. I am sorry if I didn't state the problem clearly in my two postings. I'll try to refrase :

    How do the server object (the UnicastRemoteObject) get hold of some client id. I clearly need some sort of identification of the client on the server side in order to map the client to some particular client state (eg using a hashmap).