Hi Konrad, With the term "synchronous or asynchronous" you are probably referring in relation to the event, which they are called upon. Or in other words: are they part of the underlying transaction which is causing a change or are they independent of it.
In the context of JCR ResourceChangeListeners are called asynchronously to the change it (implementation-wise in the JCR ObservationEvent handler threads). While technically we could leave it unspecified and let the implementation decide if it's synchronous and asynchronous (and therefor it might have even the chance to influence the transaction), I would favor a spec which requires asynchronous execution, as we have it right now with JCR. And for that I am +1 to adding such a description to the API doc. Jörg Am Fr., 27. Juni 2025 um 17:12 Uhr schrieb Konrad Windszus <k...@apache.org >: > Hi, > Currently the javadoc at > https://www.javadoc.io/doc/org.apache.sling/org.apache.sling.api/latest/org/apache/sling/api/resource/observation/ResourceChangeListener.html > does not specify when exactly the listener is called and if that happens > synchronously or asynchronously. If it happens synchronously it should also > be clarified if other ResourceResolvers already may see those changes or > not yet. > > Looking at > https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/fe35d53a1b0f8ff1a7616909f16539b759bd0bdd/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java#L97 > it seems it inherits from > https://developer.adobe.com/experience-manager/reference-materials/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/observation/EventListener.html > > "Event listeners are notified asynchronously, and see events after they > occur and the transaction is committed.” > > I think adding a similar sentence to the Javadoc of ResourceChangeListener > would be helpful. WDYT? > Are all event listeners of resource resolvers supposed to behave like this? > > Konrad -- https://cqdump.joerghoh.de