OK, allow me to broaden the question. We are getting mysterious repository corruption as previously detailed. I'm fairly certain that this is related to a task I have that scans Resources and sets some node properties but I can't pin down what I might be doing wrong. Are there any common mistakes that might cause the "Item does not exist anymore" exception? I can describe my code in more depth if that would help, but it is rather involved.
-----Original Message----- From: Carsten Ziegeler [mailto:[email protected]] Sent: Thursday, November 19, 2015 4:44 PM To: [email protected] Subject: Re: ResourceResolver and thread safety ResourceResolver is as stated not thread safe, therefore it should not be used concurrently by different threads. However, if you create the resource resolver through the factory yourself you can pass it on to another thread. ResourceResolver.commit() can be called multiple times. HTH Regards Carsten Am 19.11.15 um 10:22 schrieb Roll, Kevin: > We are experiencing unexplained corruption in our Sling repository. This > takes the form of > > 11:18:00.203 ERROR [Apache Sling JCR Resource Event Queue Processor] > <o.a.s.j.r.i.h.jcr.JcrNodeResource> Unable to get resource type for node node > 8dfdf81a-8db6-4c6e-be54-43f5ee2220b2 > javax.jcr.InvalidItemStateException: Item does not exist anymore: > 8dfdf81a-8db6-4c6e-be54-43f5ee2220b2 > at > org.apache.jackrabbit.core.ItemImpl.itemSanityCheck(ItemImpl.java:116) > I'm attempting to track down what I might be doing wrong that could cause > this to happen. I was a little scared when I read the docs for > ResourceResolver and I found that it is not thread safe. However, after > logging out the instances I get from > ResourceResolverFactory.getAdministrativeResourceResolver() it seems that I > am getting unique instances each time. As all of these tasks and jobs run on > separate threads it would be a big problem if I inadvertently reused a > ResourceResolver. Is this something I need to worry about? > > Also, is it safe/proper to call ResourceResolver.commit() multiple times, or > should I do this once? > > Thanks! > > -- Carsten Ziegeler Adobe Research Switzerland [email protected]
