code: public T setDuration(long duration, TimeUnit units) {
      checkNotNull(units);
  
      this.duration = units.toMillis(duration);
  
      return getThis();
    }
docs: Stop writing the output after duration is reached.
  
  @param duration The duration
  @param units The units the duration is in
  @return this