private void addToPendingNanos(final long amount) {
    long currentValue;
    long newValue;
    do {
      currentValue = pendingNanos.get();
      newValue = MathUtil.clampAdd(currentValue, amount);
    } while (!pendingNanos.compareAndSet(currentValue, newValue));
  }
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