code: protected T _getResultWithTimeout(final long timeout) throws TimeoutException {
          if(timeout <= 0)
              cond.waitFor(this::hasResult);
          else if(!cond.waitFor(this::hasResult, timeout, TimeUnit.MILLISECONDS))
              throw new TimeoutException();
          return result;
      }
docs: Blocks until a result is available, or timeout milliseconds have elapsed. Needs to be called with lock held
  @param timeout in ms
  @return An object
  @throws TimeoutException If a timeout occurred (implies that timeout > 0)