hunt.shiro.subject.support.SubjectRunnable

Undocumented in source.

Members

Classes

SubjectRunnable
class SubjectRunnable

A {@code SubjectRunnable} ensures that a target/delegate {@link Runnable Runnable} will execute such that any call to {@code SecurityUtils.}{@link hunt.shiro.SecurityUtils#getSubject() getSubject()} during the {@code Runnable}'s execution will return the associated {@code Subject} instance. The {@code SubjectRunnable} instance can be run on any thread (the current thread or asynchronously on another thread) and the {@code SecurityUtils.getSubject()} call will still work properly. This implementation also guarantees that Shiro's thread state will be identical before and after execution to ensure threads remain clean in any thread-pooled environment. <p/> When instances of this class {@link Runnable#run() run()}, the following occurs: <ol> <li>The Subject and any of its associated thread state is first bound to the thread that executes the {@code Runnable}.</li> <li>The delegate/target {@code Runnable} is {@link #doRun(Runnable) run}</li> <li>Any previous thread state that might have existed before the {@code Subject} was bound is fully restored</li> </ol> <p/>

Meta