Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private JoinWindows(final long beforeMs,
this.maintainDurationMs = maintainDurationMs;
}

@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Deprecated // removing segments from Windows will fix this
private JoinWindows(final long beforeMs,
final long afterMs,
final long graceMs,
Expand Down Expand Up @@ -131,7 +131,6 @@ public static JoinWindows of(final long timeDifferenceMs) throws IllegalArgument
* @param timeDifference join window interval
* @throws IllegalArgumentException if {@code timeDifference} is negative or can't be represented as {@code long milliseconds}
*/
@SuppressWarnings("deprecation")
public static JoinWindows of(final Duration timeDifference) throws IllegalArgumentException {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(timeDifference, "timeDifference");
return of(ApiUtils.validateMillisecondDuration(timeDifference, msgPrefix));
Expand All @@ -148,7 +147,6 @@ public static JoinWindows of(final Duration timeDifference) throws IllegalArgume
* @throws IllegalArgumentException if the resulting window size is negative
* @deprecated Use {@link #before(Duration)} instead.
*/
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Deprecated
public JoinWindows before(final long timeDifferenceMs) throws IllegalArgumentException {
return new JoinWindows(timeDifferenceMs, afterMs, graceMs, maintainDurationMs, segments);
Expand All @@ -164,7 +162,6 @@ public JoinWindows before(final long timeDifferenceMs) throws IllegalArgumentExc
* @param timeDifference relative window start time
* @throws IllegalArgumentException if the resulting window size is negative or {@code timeDifference} can't be represented as {@code long milliseconds}
*/
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
public JoinWindows before(final Duration timeDifference) throws IllegalArgumentException {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(timeDifference, "timeDifference");
return before(ApiUtils.validateMillisecondDuration(timeDifference, msgPrefix));
Expand All @@ -181,7 +178,6 @@ public JoinWindows before(final Duration timeDifference) throws IllegalArgumentE
* @throws IllegalArgumentException if the resulting window size is negative
* @deprecated Use {@link #after(Duration)} instead
*/
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Deprecated
public JoinWindows after(final long timeDifferenceMs) throws IllegalArgumentException {
return new JoinWindows(beforeMs, timeDifferenceMs, graceMs, maintainDurationMs, segments);
Expand All @@ -197,7 +193,6 @@ public JoinWindows after(final long timeDifferenceMs) throws IllegalArgumentExce
* @param timeDifference relative window end time
* @throws IllegalArgumentException if the resulting window size is negative or {@code timeDifference} can't be represented as {@code long milliseconds}
*/
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
public JoinWindows after(final Duration timeDifference) throws IllegalArgumentException {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(timeDifference, "timeDifference");
return after(ApiUtils.validateMillisecondDuration(timeDifference, msgPrefix));
Expand Down Expand Up @@ -239,7 +234,6 @@ public JoinWindows grace(final Duration afterWindowEnd) throws IllegalArgumentEx
return new JoinWindows(beforeMs, afterMs, afterWindowEndMs, maintainDurationMs, segments);
}

@SuppressWarnings("deprecation") // continuing to support Windows#maintainMs/segmentInterval in fallback mode
@Override
public long gracePeriodMs() {
// NOTE: in the future, when we remove maintainMs,
Expand All @@ -254,7 +248,6 @@ public long gracePeriodMs() {
* @throws IllegalArgumentException if {@code durationMs} is smaller than the window size
* @deprecated since 2.1. Use {@link Materialized#withRetention(Duration)} instead.
*/
@SuppressWarnings("deprecation")
@Override
@Deprecated
public JoinWindows until(final long durationMs) throws IllegalArgumentException {
Expand All @@ -272,14 +265,13 @@ public JoinWindows until(final long durationMs) throws IllegalArgumentException
* @return the window maintain duration
* @deprecated since 2.1. This function should not be used anymore as retention period can be specified via {@link Materialized#withRetention(Duration)}.
*/
@SuppressWarnings({"deprecation", "deprecatedMemberStillInUse"})
@Override
@Deprecated
public long maintainMs() {
return Math.max(maintainDurationMs, size());
}

@SuppressWarnings({"deprecation", "NonFinalFieldReferenceInEquals"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public boolean equals(final Object o) {
if (this == o) {
Expand All @@ -296,7 +288,7 @@ public boolean equals(final Object o) {
graceMs == that.graceMs;
}

@SuppressWarnings({"deprecation", "NonFinalFieldReferencedInHashCode"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public int hashCode() {
return Objects.hash(beforeMs, afterMs, graceMs, maintainDurationMs, segments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public static SessionWindows with(final long inactivityGapMs) {
*
* @throws IllegalArgumentException if {@code inactivityGap} is zero or negative or can't be represented as {@code long milliseconds}
*/
@SuppressWarnings("deprecation")
public static SessionWindows with(final Duration inactivityGap) {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(inactivityGap, "inactivityGap");
return with(ApiUtils.validateMillisecondDuration(inactivityGap, msgPrefix));
Expand Down Expand Up @@ -163,7 +162,6 @@ public SessionWindows grace(final Duration afterWindowEnd) throws IllegalArgumen

@SuppressWarnings("deprecation") // continuing to support Windows#maintainMs/segmentInterval in fallback mode
public long gracePeriodMs() {

// NOTE: in the future, when we remove maintainMs,
// we should default the grace period to 24h to maintain the default behavior,
// or we can default to (24h - gapMs) if you want to be super accurate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ private TimeWindows(final long sizeMs, final long advanceMs, final long graceMs,
}

/** Private constructor for preserving segments. Can be removed along with Windows.segments. **/
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
private TimeWindows(final long sizeMs,
final long advanceMs,
Expand Down Expand Up @@ -127,7 +126,7 @@ public static TimeWindows of(final long sizeMs) throws IllegalArgumentException
* @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}
*/
@SuppressWarnings("deprecation")
@SuppressWarnings("deprecation") // removing #of(final long sizeMs) will fix this
public static TimeWindows of(final Duration size) throws IllegalArgumentException {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(size, "size");
return of(ApiUtils.validateMillisecondDuration(size, msgPrefix));
Expand All @@ -145,7 +144,6 @@ public static TimeWindows of(final Duration size) throws IllegalArgumentExceptio
* @throws IllegalArgumentException if the advance interval is negative, zero, or larger than the window size
* @deprecated Use {@link #advanceBy(Duration)} instead
*/
@SuppressWarnings("deprecation") // will be fixed when we remove segments from Windows
@Deprecated
public TimeWindows advanceBy(final long advanceMs) {
if (advanceMs <= 0 || advanceMs > sizeMs) {
Expand All @@ -166,7 +164,7 @@ public TimeWindows advanceBy(final long advanceMs) {
* @return a new window definition with default maintain duration of 1 day
* @throws IllegalArgumentException if the advance interval is negative, zero, or larger than the window size
*/
@SuppressWarnings("deprecation") // will be fixed when we remove segments from Windows
@SuppressWarnings("deprecation") // removing #advanceBy(final long advanceMs) will fix this
public TimeWindows advanceBy(final Duration advance) {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(advance, "advance");
return advanceBy(ApiUtils.validateMillisecondDuration(advance, msgPrefix));
Expand Down Expand Up @@ -227,7 +225,6 @@ public long gracePeriodMs() {
* @deprecated since 2.1. Use {@link Materialized#retention} or directly configure the retention in a store supplier
* and use {@link Materialized#as(WindowBytesStoreSupplier)}.
*/
@SuppressWarnings("deprecation")
@Override
@Deprecated
public TimeWindows until(final long durationMs) throws IllegalArgumentException {
Expand All @@ -245,14 +242,13 @@ public TimeWindows until(final long durationMs) throws IllegalArgumentException
* @return the window maintain duration
* @deprecated since 2.1. Use {@link Materialized#retention} instead.
*/
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"})
@Override
@Deprecated
public long maintainMs() {
return Math.max(maintainDurationMs, sizeMs);
}

@SuppressWarnings({"deprecation", "NonFinalFieldReferenceInEquals"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public boolean equals(final Object o) {
if (this == o) {
Expand All @@ -269,13 +265,13 @@ public boolean equals(final Object o) {
graceMs == that.graceMs;
}

@SuppressWarnings({"deprecation", "NonFinalFieldReferencedInHashCode"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public int hashCode() {
return Objects.hash(maintainDurationMs, segments, sizeMs, advanceMs, graceMs);
}

@SuppressWarnings({"deprecation"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public String toString() {
return "TimeWindows{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public UnlimitedWindows startOn(final long startMs) throws IllegalArgumentExcept
* @return a new unlimited window that starts at {@code start}
* @throws IllegalArgumentException if the start time is negative or can't be represented as {@code long milliseconds}
*/
@SuppressWarnings("deprecation")
public UnlimitedWindows startOn(final Instant start) throws IllegalArgumentException {
final String msgPrefix = prepareMillisCheckFailMsgPrefix(start, "start");
return startOn(ApiUtils.validateMillisecondInstant(start, msgPrefix));
Expand Down Expand Up @@ -120,7 +119,6 @@ public long size() {
* @throws IllegalArgumentException on every invocation.
* @deprecated since 2.1.
*/
@SuppressWarnings("deprecation")
@Override
@Deprecated
public UnlimitedWindows until(final long durationMs) {
Expand All @@ -134,7 +132,6 @@ public UnlimitedWindows until(final long durationMs) {
* @return the window retention time that is {@link Long#MAX_VALUE}
* @deprecated since 2.1. Use {@link Materialized#retention} instead.
*/
@SuppressWarnings("deprecation")
@Override
@Deprecated
public long maintainMs() {
Expand All @@ -146,7 +143,7 @@ public long gracePeriodMs() {
return 0L;
}

@SuppressWarnings({"deprecation", "NonFinalFieldReferenceInEquals"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public boolean equals(final Object o) {
if (this == o) {
Expand All @@ -159,13 +156,13 @@ public boolean equals(final Object o) {
return startMs == that.startMs && segments == that.segments;
}

@SuppressWarnings({"deprecation", "NonFinalFieldReferencedInHashCode"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public int hashCode() {
return Objects.hash(startMs, segments);
}

@SuppressWarnings({"deprecation"}) // removing segments from Windows will fix this
@SuppressWarnings("deprecation") // removing segments from Windows will fix this
@Override
public String toString() {
return "UnlimitedWindows{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class Windows<W extends Window> {

protected Windows() {}

@SuppressWarnings("deprecation") // remove this constructor when we remove segments.
@Deprecated // remove this constructor when we remove segments.
Windows(final int segments) {
this.segments = segments;
}
Expand Down Expand Up @@ -77,7 +77,6 @@ public Windows<W> until(final long durationMs) throws IllegalArgumentException {
* @return the window maintain duration
* @deprecated since 2.1. Use {@link Materialized#retention} instead.
*/
@SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
public long maintainMs() {
return maintainDurationMs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.kafka.streams.kstream.internals;

import org.apache.kafka.common.annotation.InterfaceStability;
import org.apache.kafka.streams.kstream.Window;

/**
Expand All @@ -29,7 +28,6 @@
* @see org.apache.kafka.streams.kstream.SessionWindows
* @see org.apache.kafka.streams.processor.TimestampExtractor
*/
@InterfaceStability.Unstable

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guozhangwang This is a new cleanup on the side.

public final class SessionWindow extends Window {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public int partition() {
if (recordContext == null) {
throw new IllegalStateException("This should not happen as partition() should only be called while a record is processed");
}

return recordContext.partition();
}

Expand All @@ -139,7 +138,6 @@ public long offset() {
if (recordContext == null) {
throw new IllegalStateException("This should not happen as offset() should only be called while a record is processed");
}

return recordContext.offset();
}

Expand All @@ -148,7 +146,6 @@ public Headers headers() {
if (recordContext == null) {
throw new IllegalStateException("This should not happen as headers() should only be called while a record is processed");
}

return recordContext.headers();
}

Expand All @@ -160,7 +157,6 @@ public long timestamp() {
if (recordContext == null) {
throw new IllegalStateException("This should not happen as timestamp() should only be called while a record is processed");
}

return recordContext.timestamp();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.kafka.streams.processor.internals;

import java.time.Duration;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.streams.StreamsMetrics;
Expand All @@ -31,6 +30,7 @@
import org.apache.kafka.streams.processor.To;

import java.io.File;
import java.time.Duration;
import java.util.Map;
import java.util.Objects;

Expand Down Expand Up @@ -110,14 +110,14 @@ public <K, V> void forward(final K key, final V value, final To to) {
throw new StreamsException("ProcessorContext#forward() not supported.");
}

@SuppressWarnings("deprecation")
@Override
@Deprecated
public <K, V> void forward(final K key, final V value, final int childIndex) {
throw new StreamsException("ProcessorContext#forward() not supported.");
}

@SuppressWarnings("deprecation")
@Override
@Deprecated
public <K, V> void forward(final K key, final V value, final String childName) {
throw new StreamsException("ProcessorContext#forward() not supported.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ public <K, V> void forward(final K key, final V value, final To to) {
/**
* @throws UnsupportedOperationException on every invocation
*/
@SuppressWarnings("deprecation")
@Override
@Deprecated
public <K, V> void forward(final K key, final V value, final int childIndex) {
throw new UnsupportedOperationException("this should not happen: forward() not supported in global processor context.");
}

/**
* @throws UnsupportedOperationException on every invocation
*/
@SuppressWarnings("deprecation")
@Override
@Deprecated
public <K, V> void forward(final K key, final V value, final String childName) {
throw new UnsupportedOperationException("this should not happen: forward() not supported in global processor context.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public interface InternalProcessorContext extends ProcessorContext {
*/
void setCurrentNode(ProcessorNode currentNode);

/**
* Get the current {@link ProcessorNode}
*/
ProcessorNode currentNode();

/**
Expand Down
Loading