Package org.apache.storm.windowing

## Class StatefulWindowManager<T>

- java.lang.Object
- - org.apache.storm.windowing.WindowManager<T>
  - - org.apache.storm.windowing.StatefulWindowManager<T>

- All Implemented Interfaces:
    `TriggerHandler`

      public class StatefulWindowManager<T>
      extends WindowManager<T>

  Window manager that handles windows with state persistence.

- - ### Field Summary

    - ### Fields inherited from class org.apache.storm.windowing.WindowManager

      `evictionPolicy, EXPIRE_EVENTS_THRESHOLD, queue, triggerPolicy, windowLifecycleListener`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StatefulWindowManager​(WindowLifecycleListener<T> lifecycleListener)` |
    `StatefulWindowManager​(WindowLifecycleListener<T> lifecycleListener, Collection<Event<T>> queue)` | Constructs a `StatefulWindowManager`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `compactWindow()` | expires events that fall out of the window every EXPIRE_EVENTS_THRESHOLD so that the window does not grow too big.
    `boolean` | `onTrigger()` | The callback invoked by the trigger policy.

    - ### Methods inherited from class org.apache.storm.windowing.WindowManager

      `add, add, add, getEarliestEventTs, getEventCount, getSlidingCountTimestamps, getState, restoreState, setEvictionPolicy, setTriggerPolicy, shutdown, toString`

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

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

- - ### Constructor Detail

    - #### StatefulWindowManager

          public StatefulWindowManager​(WindowLifecycleListener<T> lifecycleListener)

    - #### StatefulWindowManager

          public StatefulWindowManager​(WindowLifecycleListener<T> lifecycleListener,
                                       Collection<Event<T>> queue)

      Constructs a `StatefulWindowManager`.
      Parameters:
        `lifecycleListener` - the `WindowLifecycleListener`
        `queue` - a collection where the events in the window can be enqueued.
        Note: This collection has to be thread safe.

  - ### Method Detail

    - #### compactWindow

          protected void compactWindow()

      Description copied from class: `WindowManager`
      expires events that fall out of the window every EXPIRE_EVENTS_THRESHOLD so that the window does not grow too big.
      Overrides:
        `compactWindow` in class `WindowManager<T>`

    - #### onTrigger

          public boolean onTrigger()

      Description copied from class: `WindowManager`
      The callback invoked by the trigger policy.
      Specified by:
        `onTrigger` in interface `TriggerHandler`
      Overrides:
        `onTrigger` in class `WindowManager<T>`
      Returns:
        true if the window was evaluated with at least one event in the window, false otherwise