web service question

1
Question: 1. If my app uses session, is there a facility to provide session replication, which will be available to all instances of my application? Use case provided: 1. My app is talking to another web service on user’s behalf 2. I need to get this user authenticated by that web service 3. This web service on authentication provides a token which I should use for subsequent calls, this is valid only for this user 4. I need to cache this token I don’t want to persist this token as this may expire, so I’d like to keep it in user specific session 5. Once the user logs out, the session will be gone and I don’t have to worry about clean up PS I think this question is irrelevant because a web service user is a non-persistent user which can only execute one request, correct? (And of course it cannot be the same as a web client user.)
asked
1 answers
0

1) Why do you want to replicate a session? If load balancing is used, usually the sessions are distributed over instances, not the requests, meaning requests of a single session will be served by a single instance, so there is no need for replication at all.

4) You can just use a java hashmap to keep data just in memory, and check whether the corresponding session is still active on a regular basis. Look at the community commons locking system for an example.

answered