Class TimeLimit
java.lang.Object
com.swiftmq.impl.streams.comp.memory.limit.TimeLimit
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionvoidChecks the Memory limits and deletes Messages that doesn't fit in the limitdays(int n) Adds n days to the limit.hours(int n) Adds n hours to the limit.limit()Creates a new LimitBuilder and that chains new Limits to the corresponding Memorymilliseconds(long n) Adds n milliseconds to the limit.minutes(int n) Adds n minutes to the limit.onRetire(RetirementCallback callback) Sets a callback which is called for each Message that is retired (removed by a Limit).seconds(int n) Adds n seconds to the limit.sliding()Marks it as sliding count limit (default).toString()tumbling()Marks it as tumbling count limit.
-
Method Details
-
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
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
Adds n days to the limit.- Parameters:
n- days- Returns:
- TimeLimit
-
hours
Adds n hours to the limit.- Parameters:
n- hours- Returns:
- TimeLimit
-
minutes
Adds n minutes to the limit.- Parameters:
n- minutes- Returns:
- TimeLimit
-
seconds
Adds n seconds to the limit.- Parameters:
n- seconds- Returns:
- TimeLimit
-
milliseconds
Adds n milliseconds to the limit.- Parameters:
n- milliseconds- Returns:
- TimeLimit
-
checkLimit
public void checkLimit()Description copied from interface:LimitChecks the Memory limits and deletes Messages that doesn't fit in the limit- Specified by:
checkLimitin interfaceLimit
-
onRetire
Description copied from interface:LimitSets a callback which is called for each Message that is retired (removed by a Limit). -
limit
Description copied from interface:LimitCreates a new LimitBuilder and that chains new Limits to the corresponding Memory -
toString
-