jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boni Gopalan \(BioImagene\)" <Bon...@bioimagene.com>
Subject RE: Posts on JCR and Jackrabbit
Date Mon, 24 Nov 2008 10:47:52 GMT
Jukka : thanks for taking time to look through my code.

RepositoryUtil.logout(...) takes in parameter 'String sessionId' , not
'String userName'.  SessionID is an UUID generated and mapped into
SessionWrapper.  In my testcases (The code is hosted on google code) the
multi session parallel existence and logout (With same user id or
different ) is tested.  RepositoryUtil, as such will evolve as I build
through the application.  Currently, each call to login() will return a
unique SessionWrapper and as per implementation the application can
either call logout() to release the resources or the resource releasing
will happen when VM invokes finalize() on the SessionWrapper.  I will
not call the finalize() strategy robust but that is what I have now :-)

I introduced SessionWrapper exactly to keep and manage different
Sessions per thread (Planning to expand the example to a Blogging app.)


-----Original Message-----
From: Jukka Zitting [mailto:jukka.zitting@gmail.com] 
Sent: 24 November 2008 15:58
To: users@jackrabbit.apache.org
Subject: Re: Posts on JCR and Jackrabbit


On Mon, Nov 24, 2008 at 9:59 AM, Boni Gopalan (BioImagene)
<Boni.G@bioimagene.com> wrote:
> http://whiteboardjunkie.wordpress.com/
> I am writing a series of posts on using JCR in enterprise


> I started writing yesterday.  As of now most of the posts are
> rudimentary in nature.  Please point out mistakes and areas of
> improvement.

I looked at your "Managing JCR Sessions" post and I'm a bit confused
about what you're trying to do.

Why is

    SessionWrapper session = RepositoryUtil.login(username, password);
    try {
    } finally {

better than

    Session session = repository.login(username, password);
    try {
    } finally {


Also, consider two threads doing the following:

    SessionWrapper session = RepositoryUtil.login(username, password);

The following interleaving will break the code:

    A: SessionWrapper sessionA = RepositoryUtil.login(username,

    B: SessionWrapper sessionB = RepositoryUtil.login(username,
    B: sessionB.getRootNode();
    B: RepositoryUtil.logout(username);

    A: sessionA.getRootNode();
    A: RepositoryUtil.logout(username);

This wouldn't be a problem if you used normal Repository.login() and


Jukka Zitting

View raw message