java.lang.Object
com.swiftmq.impl.streams.comp.memory.limit.TimeLimit
All Implemented Interfaces:
Limit

public class TimeLimit extends Object implements Limit
A TimeLimit keeps a Memory at a specific time window (e.g. last 30 secs) and removes older Messages if necessary.
Author:
IIT Software GmbH, Muenster/Germany, (c) 2016, All Rights Reserved
  • Method Details

    • sliding

      public TimeLimit sliding()
      Marks it as sliding count limit (default). If a new Message is being added and the limit is reached, the oldest Message will retire.
      Returns:
      this
    • tumbling

      public TimeLimit tumbling()
      Marks it as tumbling count limit. If a new Message is being added and the limit is reached, all Messages will retire and the Memory is empty.
      Returns:
      this
    • days

      public TimeLimit days(int n)
      Adds n days to the limit.
      Parameters:
      n - days
      Returns:
      TimeLimit
    • hours

      public TimeLimit hours(int n)
      Adds n hours to the limit.
      Parameters:
      n - hours
      Returns:
      TimeLimit
    • minutes

      public TimeLimit minutes(int n)
      Adds n minutes to the limit.
      Parameters:
      n - minutes
      Returns:
      TimeLimit
    • seconds

      public TimeLimit seconds(int n)
      Adds n seconds to the limit.
      Parameters:
      n - seconds
      Returns:
      TimeLimit
    • milliseconds

      public TimeLimit milliseconds(long n)
      Adds n milliseconds to the limit.
      Parameters:
      n - milliseconds
      Returns:
      TimeLimit
    • checkLimit

      public void checkLimit()
      Description copied from interface: Limit
      Checks the Memory limits and deletes Messages that doesn't fit in the limit
      Specified by:
      checkLimit in interface Limit
    • onRetire

      public Limit onRetire(RetirementCallback callback)
      Description copied from interface: Limit
      Sets a callback which is called for each Message that is retired (removed by a Limit).
      Specified by:
      onRetire in interface Limit
      Parameters:
      callback - Callback
      Returns:
      Limit
    • limit

      public LimitBuilder limit()
      Description copied from interface: Limit
      Creates a new LimitBuilder and that chains new Limits to the corresponding Memory
      Specified by:
      limit in interface Limit
      Returns:
      LimitBuilder
    • toString

      public String toString()
      Overrides:
      toString in class Object