@Override
  public int unlockDatabase(Hive hiveDB, UnlockDatabaseDesc unlockDb) throws HiveException {
    HiveLockManager lockMgr = getAndCheckLockManager();

    String dbName = unlockDb.getDatabaseName();

    Database dbObj = hiveDB.getDatabase(dbName);
    if (dbObj == null) {
      throw new HiveException("Database " + dbName + " does not exist ");
    }
    HiveLockObject obj = new HiveLockObject(dbObj.getName(), null);

    List<HiveLock> locks = lockMgr.getLocks(obj, false, false);
    if ((locks == null) || (locks.isEmpty())) {
      throw new HiveException("Database " + dbName + " is not locked ");
    }

    for (HiveLock lock: locks) {
      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