Default no-argument constructor.
Convenience method that simplifies binding the application's SecurityManager instance to the ThreadContext. <p/> <p>The method's existence is to help reduce casting in code and to simplify remembering of ThreadContext key names. The implementation is simple in that, if the SecurityManager is not <tt>null</tt>, it binds it to the thread, i.e.: <p/> <pre> if (securityManager !is null) { put( SECURITY_MANAGER_KEY, securityManager); }</pre>
Convenience method that simplifies binding a Subject to the ThreadContext. <p/> <p>The method's existence is to help reduce casting in your own code and to simplify remembering of ThreadContext key names. The implementation is simple in that, if the Subject is not <tt>null</tt>, it binds it to the thread, i.e.: <p/> <pre> if (subject !is null) { put( SUBJECT_KEY, subject ); }</pre>
Returns the object for the specified <code>key</code> that is bound to the current thread.
Returns the ThreadLocal Map. This Map is used internally to bind objects to the current thread by storing each object under a unique key.
Convenience method that simplifies retrieval of the application's SecurityManager instance from the current thread. If there is no SecurityManager bound to the thread (probably because framework code did not bind it to the thread), this method returns <tt>null</tt>. <p/> It is merely a convenient wrapper for the following: <p/> <code>return (SecurityManager)get( SECURITY_MANAGER_KEY );</code> <p/> This method only returns the bound value if it exists - it does not remove it from the thread. To remove it, one must call {@link #unbindSecurityManager() unbindSecurityManager()} instead.
Convenience method that simplifies retrieval of a thread-bound Subject. If there is no Subject bound to the thread, this method returns <tt>null</tt>. It is merely a convenient wrapper for the following: <p/> <code>return (Subject)get( SUBJECT_KEY );</code> <p/> This method only returns the bound value if it exists - it does not remove it from the thread. To remove it, one must call {@link #unbindSubject() unbindSubject()} instead.
Binds <tt>value</tt> for the given <code>key</code> to the current thread. <p/> <p>A <tt>null</tt> <tt>value</tt> has the same effect as if <tt>remove</tt> was called for the given <tt>key</tt>, i.e.: <p/> <pre> if ( value is null ) { remove( key ); }</pre>
Unbinds the value for the given <code>key</code> from the current thread.
{@link ThreadLocal#remove Remove}s the underlying {@link ThreadLocal ThreadLocal} from the thread. <p/> This method is meant to be the final 'clean up' operation that is called at the end of thread execution to prevent thread corruption in pooled thread environments.
Allows a caller to explicitly set the entire resource map. This operation overwrites everything that existed previously in the ThreadContext - if you need to retain what was on the thread prior to calling this method, call the {@link #getResources()} method, which will give you the existing state.
Convenience method that simplifies removal of the application's SecurityManager instance from the thread. <p/> The implementation just helps reduce casting and remembering of the ThreadContext key name, i.e it is merely a convenient wrapper for the following: <p/> <code>return (SecurityManager)remove( SECURITY_MANAGER_KEY );</code> <p/> If you wish to just retrieve the object from the thread without removing it (so it can be retrieved later during thread execution), use the {@link #getSecurityManager() getSecurityManager()} method instead.
Convenience method that simplifies removal of a thread-local Subject from the thread. <p/> The implementation just helps reduce casting and remembering of the ThreadContext key name, i.e it is merely a convenient wrapper for the following: <p/> <code>return (Subject)remove( SUBJECT_KEY );</code> <p/> If you wish to just retrieve the object from the thread without removing it (so it can be retrieved later during thread execution), you should use the {@link #getSubject() getSubject()} method for that purpose.
Private internal log instance.
A ThreadContext provides a means of binding and unbinding objects to the current thread based on key/value pairs. <p/> <p>An internal {@link java.util.HashMap} is used to maintain the key/value pairs for each thread.</p> <p/> <p>If the desired behavior is to ensure that bound data is not shared across threads in a pooled or reusable threaded environment, the application (or more likely a framework) must bind and remove any necessary values at the beginning and end of stack execution, respectively (i.e. individually explicitly or all via the <tt>clear</tt> method).</p>
@see #remove()