Class DefaultThreadContextService

    • Constructor Detail

      • DefaultThreadContextService

        public DefaultThreadContextService()
    • Method Detail

      • executeInContext

        public <R,​T extends java.lang.Throwable> R executeInContext​(ThreadContextService.Executor<R,​T> wrapper)
                                                                   throws T extends java.lang.Throwable
        Description copied from interface: ThreadContextService
        Execute the wrapper code in the context of the specified user
        Specified by:
        executeInContext in interface ThreadContextService
        Type Parameters:
        R - The type of the return value
        T - The type of the exception thrown by the wrapper
        Parameters:
        wrapper - The code to execute in that context
        Returns:
        The result of method being executed
        Throws:
        T - The exception thrown by the wrapper if an error occurs
        T extends java.lang.Throwable
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value)
        Description copied from interface: ThreadContext
        Sets the given value Object to the Session as attribute with the given name
        Specified by:
        setAttribute in interface ThreadContext
        Parameters:
        name - the name of the attribute
        value - the value to be set
      • getAttribute

        public <T> T getAttribute​(java.lang.String name)
        Description copied from interface: ThreadContext
        Returns for the given session attribute name the value
        Specified by:
        getAttribute in interface ThreadContext
        Parameters:
        name - the attribute name
        Returns:
        null if no attribute with the given name is stored in the session
      • removeAttribute

        public void removeAttribute​(java.lang.String name)
        Description copied from interface: ThreadContext
        Removes the given attribute from the current session. Do nothing if the attribute doesn't exists in the session.
        Specified by:
        removeAttribute in interface ThreadContext
        Parameters:
        name - the attribute name
      • createLocalThreadContext

        protected ThreadContext createLocalThreadContext()
      • removeLocalThreadContext

        protected void removeLocalThreadContext()