public void waitForCheckAndSendCall(int count) throws InterruptedException {
      while (true) {
        synchronized (messageLock) {
          assert checkAndSendCount <= count;
          if (checkAndSendCount == count) {
            checkAndSendCount = 0;
            return;
          }
          messageLock.wait(200);
        }
      }
    }
Note: this only works for testing the lack of invocations from the main thread.
llap-tez/src/test/org/apache/hadoop/hive/llap/tezplugins/TestLlapTaskSchedulerService.java