code: public static void clearAccessContextOnThread() {
          final Stack<AccessContext> stack = threadLocal.get();
          if (stack != null) {
              stack.pop(); // remove latest
              if (stack.isEmpty()) {
                  perfectlyClear();
              }
          }
      }
docs: Clear prepared access-context on thread.