jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandru Popescu" <the.mindstorm.mailingl...@gmail.com>
Subject Re: Working with JCR in highly concurrent applications
Date Fri, 22 Sep 2006 04:59:11 GMT
On 9/22/06, Jukka Zitting <jukka.zitting@gmail.com> wrote:
> Hi,
> On 9/21/06, Alexandru Popescu <the.mindstorm.mailinglist@gmail.com> wrote:
> > There is still some not yet answered question about JCR Session usage:
> > can it be used as a long-live object and shared between different
> > threads? Is it dangerous to do so?
> Yes. JCR sessions are not thread-safe so you should not try to use one
> concurrently from multiple threads. If you want, you can use a
> session-pool from which you borrow a sessions whenever one is needed
> to avoid the session startup cost and to keep caches loaded.

Thanks Yukka. That's what I have thought too, but I was looking more
for technical arguments, so that I understand the real risk. Or at
least a pointer to where to look for possible problems.

I mean, if the access through the shared Session is read-only, what
can go wrong? Have a node/property loaded 2 times? That's not so
bad/risky (at least at first glance :-) ).


.w( the_mindstorm )p.

> BR,
> Jukka Zitting
> --
> Yukatan - http://yukatan.fi/ - info@yukatan.fi
> Software craftsmanship, JCR consulting, and Java development

View raw message