@Override
  public int unlockTable(Hive hiveDB, UnlockTableDesc unlockTbl) throws HiveException {
    HiveLockManager lockMgr = getAndCheckLockManager();

    String tabName = unlockTbl.getTableName();
    HiveLockObject obj = HiveLockObject.createFrom(hiveDB, tabName,
        unlockTbl.getPartSpec());

    List<HiveLock> locks = lockMgr.getLocks(obj, false, false);
    if ((locks == null) || (locks.isEmpty())) {
      throw new HiveException("Table " + tabName + " is not locked ");
    }
    Iterator<HiveLock> locksIter = locks.iterator();
    while (locksIter.hasNext()) {
      HiveLock lock = locksIter.next();
      lockMgr.unlock(lock);
    }

    return 0;
  }
An implementation HiveTxnManager that includes internal methods that all
transaction managers need to implement but that we don't want to expose to
outside.
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/HiveTxnManagerImpl.java