You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by stephan lohwasser <st...@systemone.at> on 2006/03/06 14:56:22 UTC

session lifecycle

hi all,
i have a question concerning the lifecycle of a session:
how long should jcr sessions live?
is it better to open a new session for each read/write operation? or is 
it ok, or perhaps better to reuse one jcr session as long as the user is 
logged in?

thanks
stephan

Re: session lifecycle

Posted by hsp_ <pi...@ibest.com.br>.
"1) sessions hold local state information, such as transiently
modified items, namespace mappings, etc. so they *cannot* be shared
among clients that do write operations."
You mean that two clients with a session per each, can't do write operations
(whatever in the workspace) at the same time, is it?
Or you mean that two clients with the same session (I don't know how) can't
do write operations at the same time...

I realized (or may be my issue) that when two clients (one session per
client) perform write operation at the same time, occurs like a dead lock in
the repository, and the two operations get timed out.
Is it a normal behavior of jackrabbit, or do I making some mistake in my
sessions manager implementation?

Helio

Tobias Bocanegra wrote:
> 
> hi stephan
> 
> JCR sessions in jackrabbit are rather heavy objects. there are several
> caches for Paths, ItemStates, Items,  etc...some of them are shared
> among sessions, but some not. i would do some sort of session
> pooling/sharing/reuse but you need to keep in mind the following
> points:
> 
> 1) sessions hold local state information, such as transiently
> modified items, namespace mappings, etc. so they *cannot* be shared
> among clients that do write operations.
> 2) sessions are *not* 100% thread safe. so any read operation must be
> synchronized.
> 
> hope this helps,
> regards, toby
> 
> 
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
> 
> 

-- 
View this message in context: http://www.nabble.com/session-lifecycle-tf1233297.html#a6684960
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.


Re: session lifecycle

Posted by Tobias Bocanegra <to...@day.com>.
hi stephan

JCR sessions in jackrabbit are rather heavy objects. there are several
caches for Paths, ItemStates, Items,  etc...some of them are shared
among sessions, but some not. i would do some sort of session
pooling/sharing/reuse but you need to keep in mind the following
points:

1) sessions hold local state information, such as transiently
modified items, namespace mappings, etc. so they *cannot* be shared
among clients that do write operations.
2) sessions are *not* 100% thread safe. so any read operation must be
synchronized.

hope this helps,
regards, toby


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---