code: private Subject getJ2CInvocationSubject() throws ResourceException {
  
          Subject j2cSubject = null;
  
          if (System.getSecurityManager() != null) {
              try {
                  j2cSubject = (Subject) AccessController.doPrivileged(
                                                                       new PrivilegedExceptionAction() {
                                                                           @Override
                                                                           public Object run() throws Exception {
                                                                               return ThreadIdentityManager.getJ2CInvocationSubject();
                                                                           }
                                                                       });
              } catch (PrivilegedActionException pae) {
                  FFDCFilter.processException(pae, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.finalizeSubject", "826", this);
                  Tr.error(tc, "FAILED_DOPRIVILEGED_J2CA0060", pae);
                  Exception e = pae.getException();
                  ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.finalizeSubject() failed attempting to get local OS invocation subject");
                  re.initCause(e);
                  throw re;
              } catch (IllegalStateException ise) {
                  FFDCFilter.processException(ise, "com.ibm.ejs.j2c.ThreadIdentitySecurityHelper.finalizeSubject", "826", this);
                  Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.finalizeSubject()", ise };
                  Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
                  ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.finalizeSubject() failed attempting to get local OS invocation subject");
                  re.initCause(ise);
                  throw re;
              }
  
          } else {
              j2cSubject = ThreadIdentityManager.getJ2CInvocationSubject();
          }
  
          return j2cSubject;
      }
docs: Retrieve the invocation subject on the thread and J2C-ize it (which means fit it
  with a GenericCredential representing the user's native UTOKEN on z/OS).
  
  The J2C invocation subject is used on the subsequent call to beforeGettingConnection.
  
  Basically this method is just a wrapper around ThreadIdentityManager.getJ2CInvocationSubject
  with Java 2 SecurityManager handling.
  
  @return Subject the J2C invocation subject
  
  @throws ResourceException