code: public static Object setAppThreadIdentity(Subject subject) throws ThreadIdentityException {
          LinkedHashMap<ThreadIdentityService, Object> token = null;
          for (ThreadIdentityService tis : threadIdentityServices) {
              if (tis.isAppThreadIdentityEnabled()) {
                  try {
                      Object tokenReturnedFromSet = tis.set(subject);
                      if (tokenReturnedFromSet != null) {
                          if (token == null) {
                              token = new LinkedHashMap<ThreadIdentityService, Object>();
                          }
                          token.put(tis, tokenReturnedFromSet);
                      }
                  } catch (Exception e) {
                      com.ibm.ws.ffdc.FFDCFilter.processException(e, thisClass, "251");
                      resetCheckedInternal(token, e);
                  }
              }
          }
          return token;
      }
docs: Set the subject's identity as the thread identity.
  
  This method is used by app containers. It checks whether app thread
  identity is enabled for the registered ThreadIdentityService instance(s)
  before setting the identity.
  
  @return A token representing the identity previously on the thread.
  This token must be passed to the subsequent reset call.
  Returns null if thread identity support is disabled.
  @throws ThreadIdentityException