a single request is processed by a single thread. what might happen
is, if you hit a page that has images, the browser will open more
requests to retrieve those images - which will create more threads.

what you should do is handle the session creation lazily - only create
it when it is requested. use the filter to close the session (if its
there) and reset a threadlocal holder rather then create the session
in the filter.

see brix-cms.googlecode.com - there is code in there that does just that.

-igor

On Wed, Feb 4, 2009 at 2:19 PM, Edgar Merino <[email protected]> wrote:
> Hello,
>
>   I'm implementing a j2ee filter to obtain a jcr session per http request
> (using a threadlocal), however it sometimes opens more than once session
> when I open a webpage, I'm thinking this is because many threads are
> involved in a single request, but this affects performance (a lot), what
> workaround can I apply to avoid this kind of overhead (to have a real
> session per request instead of session per thread?).
>
> Correct me if I made the wrong assumptions,
> Edgar Merino
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to