AEM 6 and getServiceResourceResolver()

For those of you fortunate to work on an AEM 6 project, I am sure that you are starting to discover those subtle differences between AEM 5.x and 6.x. Well, I discovered my first painful difference while moving from ResourceResolverFactory.getAdministrativeResourceResolver() to ResourceResolverFactory.getServiceResourceResolver(). Other than the new requirement to configure Apache Sling Service User Mapper Service, the big difference is that you can't use the returned ResourceResolver for long running services anymore. If you do, you end up with a ResourceResolver that has a view of the repository at the time when the resource resolver was created. When switching over to ResourceResolverFactory.getServiceResourceResolver(), remember to close your resource resolver as soon as you're finished with it. 

The Javadocs indicate this, but in my experience most developers rarely take the time to read the documentation.