jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: Oak API - a top down look
Date Wed, 18 Apr 2012 07:06:20 GMT
Hi,

On Wed, Apr 18, 2012 at 8:51 AM, Felix Meschberger <fmeschbe@adobe.com> wrote:
> IIUIC there is no notion of a workspace here, right ? So to implement JCR workspaces,
> those might be to top level ContentTree below the root ?

We can handle this in two ways:

1. Specify the workspace name as a parameter to either login() or
getCurrentContentTree().
2. Have the root ContentTree represent the entire repository with
workspaces below it as subtrees.

Personally I'd prefer option 2 since it makes it much easier to handle
cross-workspace operations, but there are complications with login()
that's in Jackrabbit 2 more or less workspace-specific.

>> All `ContentRepository` and `ContentSession` instances are thread-safe.
>> ...
>> `ContentTree` instances are *not* thread-safe...
>
> I think it is a good thing to clearly state thread-safe-ness. But I am worried
> about ContentTree not being thread-safe..

By declaring as not thread-safe, we avoid having to worry about
synchronization and concurrent access in a lot of fairly complicated
bits of code (refresh, commit, etc.). And since a client can easily
acquire any number of parallel ContentTree instances, ensuring
thread-safety shouldn't be a problem for the client.

>>    ContentTree tree = ...;
>>    ContentTree subtree = tree.addSubtree("hello");
>>    subtree.setProperty("message", "Hello, World!");
>>    tree.commit();
>
> Particularly this one worries me most: We are now leaving the turf of immutable value
> objects again and enter concurrency problem prone terrain ...

As mentioned above, these trees are only mutable by the client, so
there's no need to worry about concurrent changes from elsewhere. So
for example traversing through the content tree will never encounter
concurrent changes unless the client itself modifies things. And the
underlying content model at the MicroKernel level is still fully
immutable.

BR,

Jukka Zitting

Mime
View raw message