Class SubjectThreadState

    • Constructor Summary

      Constructors 
      Constructor Description
      SubjectThreadState​(Subject subject)
      Creates a new SubjectThreadState that will bind and unbind the specified Subject to the thread
    • Constructor Detail

      • SubjectThreadState

        public SubjectThreadState​(Subject subject)
        Creates a new SubjectThreadState that will bind and unbind the specified Subject to the thread
        Parameters:
        subject - the Subject instance to bind and unbind from the ThreadContext.
    • Method Detail

      • getSubject

        protected Subject getSubject()
        Returns the Subject instance managed by this ThreadState implementation.
        Returns:
        the Subject instance managed by this ThreadState implementation.
      • restore

        public void restore()
        Removes all thread-state that was bound by this instance. If any previous thread-bound resources existed prior to the bind call, they are restored back to the ThreadContext to ensure the thread state is exactly as it was before binding.
        Specified by:
        restore in interface ThreadState
      • clear

        public void clear()
        Completely removes the ThreadContext state. Typically this method should only be called in special cases - it is more 'correct' to restore a thread to its previous state than to clear it entirely.
        Specified by:
        clear in interface ThreadState