I inherited some legacy Business Objects code that needs some TLC. The code is a Servlet. A new IEnterpriseSession is created for every new request into the Servlet. My initial concern is that creating a new IEnterpriseSession for every request seems wasteful and leads to slow requests. Please note that this is an admin IEnterpriseSession, its used over and over again for administrative purposes.
So my question is, is it OK to just create one of these during init() for the Servlet and use it over and over again for as long as the server is up? Can it be shared across threads or does it have to be ThreadLocal? Is there a known timeout exception that is thrown if the session grows stale?