Today to acquire a LocalSession (CoreSession implementation) we do (in CoreInstance): Framework.getService(CoreSession.class) which uses the RepositoryService.getAdapter method.
This is a problem when using recent code in nuxeo-apidoc-server in org.nuxeo.apidoc.introspection.ServerInfo which does:
protected static boolean isServiceOverriden(RegistrationInfo ri, String serviceName) { Class<?> typeof = Class.forName(serviceName); final Object adapter = ri.getComponent().getAdapter(typeof); final Object service = Framework.getService(typeof); if (adapter == service) { return false; } return service.getClass() != adapter.getClass();
So just checking the adapter actually instantiates a CoreSession, which is bad (and it's not closed).
Instead to acquire the CoreSession we could simply call an explicit method on the RepositoryService.