cadonna commented on a change in pull request #10740:
URL: https://github.com/apache/kafka/pull/10740#discussion_r655626428



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/kstream/TimeWindows.java
##########
@@ -85,14 +87,11 @@ private TimeWindows(final long sizeMs, final long 
advanceMs, final long graceMs)
      * @param size The size of the window
      * @return a new window definition with default maintain duration of 1 day
      * @throws IllegalArgumentException if the specified window size is zero 
or negative or can't be represented as {@code long milliseconds}
+     * @deprecated since 3.0 Use {@link #ofSizeWithNoGrace(Duration)} } instead
      */
+    @Deprecated
     public static TimeWindows of(final Duration size) throws 
IllegalArgumentException {
-        final String msgPrefix = prepareMillisCheckFailMsgPrefix(size, "size");
-        final long sizeMs = validateMillisecondDuration(size, msgPrefix);
-        if (sizeMs <= 0) {
-            throw new IllegalArgumentException("Window size (sizeMs) must be 
larger than zero.");
-        }
-        return new TimeWindows(sizeMs, sizeMs, DEFAULT_GRACE_PERIOD_MS);
+        return ofSizeWithNoGrace(size);

Review comment:
       I think this needs to be `ofSizeAndGrace(size, grace)` where `grace` is 
`Duration.ofMillis(Math.max(Duration.ofDays(1).toMillis() - size.toMillis(), 
0))` to mimic the deprecated behavior.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to