public boolean canSchedule(SchedulerGroupAccountant accountant) {
    return accountant.totalReservedThreads() < getTableThreadsHardLimit();
  }
@Test
  public void testCanSchedule()
      throws Exception {
    ResourceManager rm = getResourceManager(2, 5, 1, 3);

    SchedulerGroupAccountant accountant = mock(SchedulerGroupAccountant.class);
    when(accountant.totalReservedThreads()).thenReturn(3);
    assertFalse(rm.canSchedule(accountant));

    when(accountant.totalReservedThreads()).thenReturn(2);
    assertTrue(rm.canSchedule(accountant));
  }