Hi,
With OAK-938 [1] Antonio uncovered another consequence of introducing auto refreshing sessions [2]:
Acquiring a UserManager from a auto refreshing session, that UserManager instance would not "inherit" the auto refresh setting. That is, although the session itself might after a while see a newer revision due to an automatic refresh, the UserManager will still stay on the revision the session had when it was acquired. See https://github.com/apache/jackrabbit-oak/blob/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerTest.java#L89 for a test case.
We might have similar issues with other entities tied to a session like PrincipalManager, VersionManager, ... Basically all (indirect) callers of SessionDelegate#getRoot() are suspect... and that's quite a list.
To me the cleanest solution seems to be changing SessionDelegate#getRoot() to SessionDelegate#getRootProvider() thus signalling to clients they need to acquire the root on an as need basis.
WDYT? Michael [1] https://issues.apache.org/jira/browse/OAK-938 [2] https://issues.apache.org/jira/browse/OAK-803
