Hi,
On Mon, Nov 24, 2008 at 9:59 AM, Boni Gopalan (BioImagene)
<[EMAIL PROTECTED]> wrote:
> http://whiteboardjunkie.wordpress.com/
>
> I am writing a series of posts on using JCR in enterprise applications.
Nice!
> 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 {
RepositoryUtil.logout(username);
}
better than
Session session = repository.login(username, password);
try {
...
} finally {
session.logout();
}
?
Also, consider two threads doing the following:
SessionWrapper session = RepositoryUtil.login(username, password);
session.getRootNode();
RepositoryUtil.logout(username);
The following interleaving will break the code:
A: SessionWrapper sessionA = RepositoryUtil.login(username, password);
B: SessionWrapper sessionB = RepositoryUtil.login(username, password);
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
Session.logout().
BR,
Jukka Zitting