Package org.apache.storm.windowing

# Class WatermarkTimeEvictionPolicy<T>

java.lang.Object
org.apache.storm.windowing.TimeEvictionPolicy<T>
org.apache.storm.windowing.WatermarkTimeEvictionPolicy<T>

All Implemented Interfaces:
  `EvictionPolicy<T,EvictionContext>`

public class WatermarkTimeEvictionPolicy<T> extends TimeEvictionPolicy<T>
An eviction policy that evicts events based on time duration taking watermark time and event lag into account.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.apache.storm.windowing.EvictionPolicy

  `EvictionPolicy.Action`

- ## Field Summary

  ### Fields inherited from class org.apache.storm.windowing.TimeEvictionPolicy

  `evictionContext`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WatermarkTimeEvictionPolicy(int windowLength)`
  Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis.
  `WatermarkTimeEvictionPolicy(int windowLength, int lag)`
  Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `EvictionPolicy.Action`
  `evict(Event<T> event)`
  Decides if an event should be expired from the window, processed in the current window or kept for later processing.
  `String`
  `toString()`

  ### Methods inherited from class org.apache.storm.windowing.TimeEvictionPolicy

  `getContext, getState, reset, restoreState, setContext, track`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### WatermarkTimeEvictionPolicy

    public WatermarkTimeEvictionPolicy(int windowLength)
    Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis.
    Parameters:
      `windowLength` - the window length in milliseconds

  - ### WatermarkTimeEvictionPolicy

    public WatermarkTimeEvictionPolicy(int windowLength, int lag)
    Constructs a WatermarkTimeEvictionPolicy that evicts events older than the given window length in millis. The lag parameter can be used in the case of event based ts to break the queue scan early.
    Parameters:
      `windowLength` - the window length in milliseconds
      `lag` - the max event lag in milliseconds

- ## Method Details

  - ### evict

    public EvictionPolicy.Action evict(Event<T> event)
    Decides if an event should be expired from the window, processed in the current window or kept for later processing.

    Keeps events with future ts in the queue for processing in the next window. If the ts difference is more than the lag, stops scanning the queue for the current window.
    Specified by:
      `evict` in interface `EvictionPolicy<T,EvictionContext>`
    Overrides:
      `evict` in class `TimeEvictionPolicy<T>`
    Parameters:
      `event` - the input event
    Returns:
      the `EvictionPolicy.Action` to be taken based on the input event

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `TimeEvictionPolicy<T>`