Tomcat multiinstance patch review

Pull request for internal reviewing. Do NOT merge this.

The code is not fully tested yet.