/**
   * Schedules the client with the task, if it is in the proper threadgroup and has not thrown a
   * stop scheduling order for it.
   */
  protected boolean schedule(ClientRecord client, TestTask task, long now) {
    if (task.usesThreadGroup(client.getThreadGroupName())
        && !task.receivedStopSchedulingTaskOnClientOrder(client)) {
      ClientVmRecord vm = client.vm();
      synchronized (vm) {
        if (vm.isLive()) {
          synchronized (client) {
            client.setBusy(true);
            client.setTask(task);
            client.setStartTime(now);

            synchronized (task) {
              task.incrementNumTimesInUse();
            }
            assignTask(client, task);
          }
        }
      }
      return true;

    } else {
      return false;
    }
  }