Class Windows<W extends Window>

  • Type Parameters:
    W - type of the window instance
    Direct Known Subclasses:
    JoinWindows, TimeWindows, UnlimitedWindows

    public abstract class Windows<W extends Window>
    extends java.lang.Object
    The window specification for fixed size windows that is used to define window boundaries and grace period.

    Grace period defines how long to wait on out-of-order events. That is, windows will continue to accept new records until stream_time >= window_end + grace_period. Records that arrive after the grace period passed are considered late and will not be processed but are dropped.

    Warning: It may be unsafe to use objects of this class in set- or map-like collections, since the equals and hashCode methods depend on mutable fields.

    See Also:
    TimeWindows, UnlimitedWindows, JoinWindows, SessionWindows, TimestampExtractor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int segments
      Deprecated.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Windows()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      abstract long gracePeriodMs()
      Return the window grace period (the time to admit out-of-order events after the end of the window.) Delay is defined as (stream_time - record_timestamp).
      long maintainMs()
      Deprecated.
      since 2.1.
      protected Windows<W> segments​(int segments)
      Deprecated.
      since 2.1 Override segmentInterval() instead.
      abstract long size()
      Return the size of the specified windows in milliseconds.
      Windows<W> until​(long durationMs)
      Deprecated.
      since 2.1.
      abstract java.util.Map<java.lang.Long,​W> windowsFor​(long timestamp)
      Create all windows that contain the provided timestamp, indexed by non-negative window start timestamps.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • segments

        @Deprecated
        public int segments
        Deprecated.
    • Constructor Detail

      • Windows

        protected Windows()
    • Method Detail

      • until

        @Deprecated
        public Windows<W> until​(long durationMs)
                         throws java.lang.IllegalArgumentException
        Deprecated.
        since 2.1. Use Materialized.withRetention(Duration) or directly configure the retention in a store supplier and use Materialized.as(WindowBytesStoreSupplier).
        Set the window maintain duration (retention time) in milliseconds. This retention time is a guaranteed lower bound for how long a window will be maintained.
        Parameters:
        durationMs - the window retention time in milliseconds
        Returns:
        itself
        Throws:
        java.lang.IllegalArgumentException - if durationMs is negative
      • maintainMs

        @Deprecated
        public long maintainMs()
        Deprecated.
        since 2.1. Use Materialized.retention instead.
        Return the window maintain duration (retention time) in milliseconds.
        Returns:
        the window maintain duration
      • segments

        @Deprecated
        protected Windows<W> segments​(int segments)
                               throws java.lang.IllegalArgumentException
        Deprecated.
        since 2.1 Override segmentInterval() instead.
        Set the number of segments to be used for rolling the window store. This function is not exposed to users but can be called by developers that extend this class.
        Parameters:
        segments - the number of segments to be used
        Returns:
        itself
        Throws:
        java.lang.IllegalArgumentException - if specified segments is small than 2
      • windowsFor

        public abstract java.util.Map<java.lang.Long,​W> windowsFor​(long timestamp)
        Create all windows that contain the provided timestamp, indexed by non-negative window start timestamps.
        Parameters:
        timestamp - the timestamp window should get created for
        Returns:
        a map of windowStartTimestamp -> Window entries
      • size

        public abstract long size()
        Return the size of the specified windows in milliseconds.
        Returns:
        the size of the specified windows
      • gracePeriodMs

        public abstract long gracePeriodMs()
        Return the window grace period (the time to admit out-of-order events after the end of the window.) Delay is defined as (stream_time - record_timestamp).