Search code examples
javaservletsbusiness-objectsbusiness-objects-sdk

Can BusinessObject's IEnterpriseSession be cached like a db connection?


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?


Solution

  • The IEnterpriseSession can be cached and reused. There is a timeout setting inside Business Objects' CMC that can end the session, so do pay attention to if the session itself is valid before using it, if you go about caching. The session itself is an actual login to the Business Objects system so should be unique per user.