private void testInheritedXLockAndChildrenXLock(final TableName tableName,
    final TestTableProcedure rootProc, final TestTableProcedure... childProcs) throws Exception {
    procedures.put(rootProc.getProcId(), rootProc);
    for (TestTableProcedure childProc : childProcs) {
      procedures.put(childProc.getProcId(), childProc);
    }
    queue.addBack(rootProc);

    // fetch and acquire first xlock proc
    Procedure<?> parentProc = queue.poll();
    assertSame(rootProc, parentProc);
    assertEquals(false, queue.waitTableExclusiveLock(parentProc, tableName));

    TestTableProcedure childProc = childProcs[childProcs.length - 1];
    // add child procedure
    queue.addFront(childProc);

    // fetch the other xlock proc
    Procedure<?> proc = queue.poll();
    assertSame(childProc, proc);
    assertEquals(false, queue.waitTableExclusiveLock(proc, tableName));
    releaseTableExclusiveLockAndComplete(proc, tableName);

    // release xlock
    releaseTableExclusiveLockAndComplete(proc, tableName);
  }
Verify the correct logic of RWLocks on the queue
hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureScheduler.java