code: public static AccessContext getAccessContextOnThread() {
          final Stack<AccessContext> stack = threadLocal.get();
          return stack != null ? stack.peek() : null;
      }
docs: Get prepared access-context on thread.
  @return The context of DB access. (NullAllowed)