private List<String> getObjectNames(HiveLockObject key) {
    List<String> parents = new ArrayList<String>();
    String   curParent   = "/" + parent + "/";
    String[] names       = key.getName().split("/");

    for (String name : names) {
      curParent = curParent + name;
      parents.add(curParent);
      curParent = curParent + "/";
    }
    return parents;
  }
@param key    object to be locked
Get the list of names for all the parents.
For eg: if you need to lock db/T/ds=1/hr=1, the following list will be returned:
{db, db/T, db/T/ds=1, db/T/ds=1/hr=1}
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/zookeeper/ZooKeeperHiveLockManager.java