code: public void cleanUpSubject() {
          if (temporarySubject != null) {
              AccessController.doPrivileged(new PrivilegedAction<Object>() {
                  @Override
                  public Object run() {
                      removeSubjectPrincipals();
                      removeSubjectPublicCredentials();
                      removeSubjectPrivateCredentials();
                      return null;
                  }
              });
          }
  
          temporarySubject = null;
      }
docs: Common Subject clean up.