@Override
    public TUGIContainingTransport getTransport(TTransport trans) {

      // UGI information is not available at connection setup time, it will be set later
      // via set_ugi() rpc.
      TUGIContainingTransport tugiTrans = transMap.get(trans);
      if (tugiTrans == null) {
        tugiTrans = new TUGIContainingTransport(trans);
        TUGIContainingTransport prev = transMap.putIfAbsent(trans, tugiTrans);
        if (prev != null) {
          return prev;
        }
      }
      return tugiTrans;
    }
Get a new <code>TUGIContainingTransport</code> instance, or reuse the
existing one if a <code>TUGIContainingTransport</code> has already been
created before using the given <code>TTransport</code> as an underlying
transport. This ensures that a given underlying transport instance
receives the same <code>TUGIContainingTransport</code>.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/security/TUGIContainingTransport.java