jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Pfister <dominique.pfis...@day.com>
Subject Re: Lifetime of a session?
Date Thu, 03 Mar 2005 11:53:28 GMT
Suhail M. Ahmed wrote:
> On Mar 2, 2005, at 9:37 PM, Sylvain Wallez wrote:
>> Suhail M. Ahmed wrote:
>>> Hi Sylvain,
>>> The Session object is returned on performing a login on the 
>>> repository. Looking at RepositoryIml you will see
>>>  Session ses = new XASessionImpl(this, lc, wspInfo.getConfig());
>>>  activeSessions.put(ses, ses);
>>> You should I think couple the repository session life cycle to your 
>>> http session life cycle. I haven't dug deeper in to the object graph 
>>> derived from session so I can't say anything about the thread safety 
>>> of Item and its sub classes. I do see some nifty synchronization in 
>>> the content store implementation so I would think that at that level 
>>> things are thread safe. I think the optimum route is to use a session 
>>> listener to login and logout from the repository.
>> That was my opinion also, but the thread-safety on session itself may 
>> be a concern if a single user issues several request simultaneously. 
>> How will the transaction manager behave in such circumstances?

I would recommend treating a Session object just like a JDBCConnection 
in the context of a webapp. If you created your own JDBCConnection 
inside the scope of your servlet service method, it is ok to store it 
inside the HttpSession object and close it when your HttpSession is 
being destroyed. If you however obtain the JDBCConnection from your 
application server environment via JNDI and store it inside your 
session, you mill most probably mess around with the application 
server's own resource pools.


View raw message