code: public static UnixUserGroupInformation readFromConf(
        Configuration conf, String attr) throws LoginException {
      String[] ugi = conf.getStrings(attr);
      if(ugi == null) {
        return null;
      }
      UnixUserGroupInformation currentUGI = null;
      if (ugi.length>0 ){
        currentUGI = user2UGIMap.get(ugi[0]);
      }
      if (currentUGI == null) {
        try {
          currentUGI = new UnixUserGroupInformation(ugi);
          user2UGIMap.put(currentUGI.getUserName(), currentUGI);
        } catch (IllegalArgumentException e) {
          throw new LoginException("Login failed: "+e.getMessage());
        }
      }
      
      return currentUGI;
    }
docs: Read a UGI from the given <code>conf</code>
  
  The object is expected to store with the property name <code>attr</code>
  as a comma separated string that starts
  with the user name followed by group names.
  If the property name is not defined, return null.
  It's assumed that there is only one UGI per user. If this user already
  has a UGI in the ugi map, return the ugi in the map.
  Otherwise, construct a UGI from the configuration, store it in the
  ugi map and return it.
  
  @param conf configuration
  @param attr property name
  @return a UnixUGI
  @throws LoginException if the stored string is ill-formatted.