Hi,

I have a case where I need to open a new JCR session / resource resolver from 
an existing one for a task that runs in a separate thread. I am using 
ResourceResolver.clone(null) for that. Documentation gives the impression it is 
a new one (since you assume a 1:1 between resource resolver instance and JCR 
session in general). But it seems the same session is returned.

I can't debug the issue, but looking at the code of the 
JcrResourceProviderFactory [2] it seems that if the original AuthenticationInfo 
is based on a JCR session explicitly passed with 
JcrResourceConstants.AUTHENTICATION_INFO_SESSION, this one will be returned. 
And not cloned through impersonation to itself.

Would it be necessary to explicitly use USER_IMPERSONATION (using the current 
user) on the authInfo?

[1] 
http://sling.apache.org/apidocs/sling6/org/apache/sling/api/resource/ResourceResolver.html#clone(java.util.Map)
[2] 
http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderFactory.java

Cheers,
Alex

Reply via email to