class KinesisWatermark {

  public Instant getCurrent(BooleanSupplier shardsUpToDate) {
    Instant now = Instant.now();
    Instant readMin = getMinReadTimestamp(now);
    if (readMin == null) {
      if (shardsUpToDate.getAsBoolean()) {
        updateLastWatermark(now.minus(SAMPLE_PERIOD), now);
      }
    } else if (shouldUpdate(now)) {
      updateLastWatermark(readMin, now);
    }
    return lastWatermark;
  }

}