@Override
  public void setWorkFactor(double workFactor) {
    if (workFactor < MIN_WORK_FACTOR) {
      throw new IllegalArgumentException("Work factor must be >= " + MIN_WORK_FACTOR);
    }
    if (workFactor > MAX_WORK_FACTOR) {
      throw new IllegalArgumentException("Work factor must be <= " + MAX_WORK_FACTOR);
    }

    workToIdleFactor = (1.0 - workFactor) / workFactor;
  }
This method may be used to throttle asynchronous processing by delaying the work completion callback.
<p>
Executes the given completion callback on the current thread. If throttling is enabled (the work factor
is less than 1.0) this method may optionally schedule the callback with a delay to satisfy the
requested work factor.

@param callback the callback to complete asynchronous work
@param workDurationNs the duration of asynchronous work in nanoseconds
samza-core/src/main/java/org/apache/samza/util/ThrottlingScheduler.java