AnsweredAssumed Answered

Repository Session pools

Question asked by alexeyg on Apr 4, 2006
Latest reply on Apr 5, 2006 by alexeyg
I am having a problem creating a JCR session pool.  Any suggestions are appreciated.

I set SimpleCreds and Repository for my Pool, then do lazy init for Repository Sessions. (using tomcat)

The problem comes up in this scenario:

1) Request A comes in, A is handled by thread P.  Session Z is created (Z is associated with P).

2) Request A is finished, session Z remains open in pool

3) Request B comes in, takes up session Z.

4) Request C comes in, is handled by thread P.  Session Z is busy - need to create new session.  Thread P attempts to create a session - Exception! (there is a session Z associated with thread P already)

What are my options?  I was thinking:

- always start the Session from a new thread (but what if a new thread matches older thread?)
- check Alfresco source code, see what Thread is remembered by, keep a mapping in my app to make sure no duplicates are started.
- keep 1 session for all "read" operations, only give out root node.

The last option seems most attractive… but are may be possible concurrency issues with giving out root nodes from one session for all "read" operations… right? 

Thank you!

Outcomes