Because of the readFully() feature, that at some time always gets called, the 
JcrModifiableValueMap will cache all the node's properties once read. Thus if 
you later do a session.refresh(false) in JCR, which discards transient changes, 
the value map will not know about it and keep returning cached transient 
changes.

We have a use case where we want this behavior and have a complete custom copy 
of the JcrModifiableValueMap code with the few changes. Obviously the code 
duplication is bad.

Can we improve on that? Make this optional?

It also has the need to write changes directly, this was once requested in 
SLING-1391 [1] which is marked as wontfix, however, it looks to me like the 
JcrModifiableValueMap nowadays writes immediately to the JCR [2].

[1] https://issues.apache.org/jira/browse/SLING-1391
[2] 
https://github.com/apache/sling/blob/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java#L451-L462

Cheers,
Alex

Reply via email to