jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek" <aklim...@day.com>
Subject Re: Clarification on Node refresh
Date Fri, 17 Oct 2008 18:49:17 GMT
Hi Micah,

the JCR spec conceptually separates the "transient" session space and
the "persisted" space. The first exists for each session and contains
the local modifications of each session (in Jackrabbit, explanation
follows). The second space is simply the one-and-only persisted data,
ie. everything that was saved() (or committed in case of the use of
transactions). This is what is stored in the database and what the
clustering synchronizes.

Now the "details" of what make up the transient space is left open to
the implementation. There are basically two choices:

(1) copy-on-read, where each read of a node creates a copy of the
persisted node in the transient space. This means after you read it
once, you would no longer see any changes made to the node by other
sessions, until you call refresh().

(2) copy-on-write (Jackrabbit), where a node is copied into the
transient space only when you modify it. This means all reads to
non-modified nodes will always give the most up-to-date veersion of
that node. That also implies two subsequents read can give different
results (which would not be the case for the copy-on-read variant). In
this case refresh() has no effect on non-modifed nodes. Jackrabbit
uses this variant since it is much more useful for most applications
(ie. you would permanently re-login to get a new session or call
refresh for all read operations).

I once noted that on the (still incomplete) wiki page for those
implementation specific things [1]. The part in the JCR spec that
talks about this is section 7.1.3.4 "Seeing Changes Made by Other
Sessions".

[1] http://wiki.apache.org/jackrabbit/JcrSpecImplementation

Regards,
Alex

On Thu, Oct 16, 2008 at 8:10 PM, Micah Whitacre <mkwhitacre@gmail.com> wrote:
> Hey All,
>  I'm trying to get a better understanding on what exactly it means to
> refresh[1].  The javadoc states that "returns all items to reflect the
> current saved state. Outside a transaction this state is simple the
> current state of persistent storage."  In my particular case the
> workspace, version manager, and PM all point to a database.  So I'm
> assuming the persistent storage is the database.  I couldn't find a
> definition of persistent storage in the specification.
>
> So what I need clarified is should refresh insure the node and its
> children are up to date with changes in the database or only up to
> date with changes in the repository instance?  In my testing I've
> noticed it has only been for changes in the repository instance.  Is
> this the correct behavior and my interpretation of "persistent
> storage" incorrect?  Or does refresh need to pull changes by other
> clustered nodes?
>
> Thanks for your help,
> Micah
>
> [1] - http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Item.html#refresh(boolean)
>

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message