public LockResponse lockResource(String dbName, String tableName, long txnId) {
    final ResourceLock prevResourceLock = locks.putIfAbsent(
        Warehouse.getQualifiedName(dbName, tableName),
        new ResourceLock(txnId, System.nanoTime(), State.ACQUIRED));
    if (prevResourceLock != null) {
      return new LockResponse(txnId, LockState.NOT_ACQUIRED);
    }
    return new LockResponse(txnId, LockState.ACQUIRED);
  }
Lock materialized view (first step for rebuild). Response contains a lock id
that corresponds to the input transaction id, and whether the lock was
ACQUIRED or NOT_ACQUIRED.
@param dbName the db name of the materialization
@param tableName the table name of the materialization
@param txnId the transaction id for the rebuild
@return the response to the lock request
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MaterializationsRebuildLockHandler.java