Class UserContextCache

  • All Implemented Interfaces:
    OBProvidable, OBSingleton

    public class UserContextCache
    extends Object
    implements OBSingleton
    The main purpose of the user context cache is to support session-less http requests without a large performance hit. With a session-less http request every request needs to log in. This can be comparatively heavy as for each request a new OBContext is created.

    The user context cache takes care of storing a cache of user contexts (on user id) which are re-used when a web-service call is done. Note that the OBContext which is cached can be re-used by multiple threads at the same time.

    Author:
    mtaal
    See Also:
    OBContext
    • Constructor Detail

      • UserContextCache

        public UserContextCache()
    • Method Detail

      • getCreateOBContext

        public OBContext getCreateOBContext​(String userId)
        Searches the ContextCache for an OBContext. If none is found a new one is created and placed in the cache.
        Parameters:
        userId - the user for which an OBContext is required
        Returns:
        the OBContext object
        See Also:
        OBContext
      • getCreateOBContext

        public OBContext getCreateOBContext​(String userId,
                                            String roleId,
                                            String orgId)
        Searches the ContextCache for an OBContext. If none is found a new one is created and placed in the cache.
        Parameters:
        userId - the user for which an OBContext is required
        roleId - the role id of the user
        orgId - the org id of the user
        Returns:
        the OBContext object
        See Also:
        OBContext