This patch contains the major changes I have done on the 3.5 branch. I will apply them on 3.6 and will only commit to 3.5 after they have proven to be robust enough.
I also added an MBean so that one can see the open sessions. On many places we keep a reference to a node (templates, trees, ...) so I had to create a LazyContentWrapper which refetches content if the original session has been closed.
We should not call super.release() as we only want to close the jcr session but not releasing the access manager