public static long validateMillisecondDuration(final Duration duration, final String messagePrefix) {
        try {
            if (duration == null) {
                throw new IllegalArgumentException(messagePrefix + VALIDATE_MILLISECOND_NULL_SUFFIX);
            }

            return duration.toMillis();
        } catch (final ArithmeticException e) {
            throw new IllegalArgumentException(messagePrefix + VALIDATE_MILLISECOND_OVERFLOW_SUFFIX, e);
        }
    }
Validates that milliseconds from {@code duration} can be retrieved.
@param duration Duration to check.
@param messagePrefix Prefix text for an error message.
@return Milliseconds from {@code duration}.
streams/src/main/java/org/apache/kafka/streams/internals/ApiUtils.java