public void restore() {
        ThreadContext.remove();
        if (!CollectionUtils.isEmpty(this.originalResources)) {
            ThreadContext.setResources(this.originalResources);
        }
    }
{@link ThreadContext#remove Remove}s all thread-state that was bound by this instance.  If any previous
thread-bound resources existed prior to the {@link #bind bind} call, they are restored back to the
{@code ThreadContext} to ensure the thread state is exactly as it was before binding.
core/src/main/java/org/apache/shiro/subject/support/SubjectThreadState.java