Caching of InitialContext with multiple users

Hi.

I have some webservices (running on Axis on a weblogic 8.1 server) which is called from muliple users, who will use a limited set of usernames/passwords (many users will use the same username and password).

Because of some performance issues I want to cache the initialcontext after it is created the first time (so that I don't have to call getAccess and authenticate the user every time).

I have no problem with this as long as only one user belonging to a group calls the method at the same time, but when two or more users calls the webservice at the same time, using the same username and password, the weblogic.security.Security.getCurrentSubject returnes a subject without any principals for the second user (the first user gets a subject with the correct principals)

Does anyone know how I can fix this?

[848 byte] By [espenfa] at [2007-11-26 18:34:35]
# 1

Best use a caching strategy where you cache the initialcontext for each group of users separately.

So if you have 2 groups, you cache 2 initialcontexts, one for each group, with a key containing the group name.

Then when you try to retrieve the cached context, you do so by that groupname.

Cachekeys could look like "group1.initial.context".

jwentinga at 2007-7-9 6:08:41 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

I do cache the initialcontext for each group separately (one initialcontext for each group). The problem is that when I have two users belonging to the same group , I want both to use the cached version of the initialcontext, but when I do this, the subject of the second call is incorrect (no privileges is attached to the subject).

espenfa at 2007-7-9 6:08:41 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...