[
https://issues.apache.org/jira/browse/JCR-890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496251
]
Marcel Reutegger commented on JCR-890:
--------------------------------------
I agree that this 'feature' is desirable however I would rather implement
sharing read only session in a decoration layer or some sort of proxy on top of
the JCR repository. We already have enough synchronization statements in the
code and introducing even more will slow down clients that are not interested
to share a session, e.g. a client that writes to a session would also be
heavily synchronized, which is unnecessary in this case.
I think we should choose a similar approach like the collections framework in
java. All collection implementations are not thread-safe (except the very old
ones from java 1.0 and 1.1), but there are wrapper classes that make them
thread-safe if the client wishes so.
This approach also has the advantage that the wrapper/decorator/proxy can throw
an exception if a client still tries to call a method that writes to the
repository. If we build the thread-safeness into the jackrabbit core we don't
have this control and clients could still write to a session that is shared.
I therefore propose the following:
- remove all synchronization in the core that is meant to support concurrent
read access to a session
- create a read only decorator that synchronizes access to session
someting along the lines:
Session session = Util.synchronizedSession(session);
// use session from multiple threads
> concurrent read-only access to a session
> ----------------------------------------
>
> Key: JCR-890
> URL: https://issues.apache.org/jira/browse/JCR-890
> Project: Jackrabbit
> Issue Type: Improvement
> Components: core
> Reporter: David Nuescheler
> Assigned To: Stefan Guggisberg
>
> Even though the JCR specification does not make a statement about Sessions
> shared across a number of threads I think it would be great for many
> applications if we could state that sharing a read-only session is supported
> by Jackrabbit.
> On many occasions in the mailing lists we stated that there should not be an
> issue with sharing a read-only session, however I think it has never been
> thoroughly tested or even specified as a "design goal".
> If we can come to an agreement that this is desirable I think it would be
> great to start including testcases to validate that behaviour and update the
> documentation respectively.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.