hunt.shiro.util.ThreadState

Undocumented in source.

Members

Interfaces

ThreadState
interface ThreadState

A {@code ThreadState} instance manages any state that might need to be bound and/or restored during a thread's execution. <h3>Usage</h3> Calling {@link #bind bind()} will place state on the currently executing thread to be accessed later during the thread's execution. <h4>WARNING</h4> After the thread is finished executing, or if an exception occurs, any previous state <b>MUST</b> be {@link #restore restored} to guarantee all threads stay clean in any thread-pooled environment. This should always be done in a {@code try/finally} block: <pre> ThreadState state = //acquire or instantiate as necessary try { state.bind(); doSomething(); //execute any logic downstream logic that might need to access the state } <b>finally { state.restore(); }</b> </pre>

Meta