Class TimeUnitChangeLimit
- All Implemented Interfaces:
Limit
The time unit window's time is based as follows (MM/DD/YYYY):
- seconds: based on minute, e.g. 10 secs at time 18:12:17 starts at 18:12:10
- minutes: based on hour, e.g. 5 mins at time 18:12:17 starts at 18:10:00
- days: based on month, e.g. 2 days at 04/17/2017 starts at 04/16/2017
- weeks: based on year, e.g. 2 weeks at 01/15/2017 starts at 01/14/2017
- months: based on year, e.g. 3 month at 05/10/2017 starts at 04/01/2017
- years: based on year, e.g. 2 years at 05/10/2017 starts at 01/01/2017
The difference between this time unit limit and a time limit is that the time limit has the window base at the time when it is started, e.g. started at 18:12:17 with a 10 secs window has a window from 18:12:17 to 18:12:27 exclusive.
A time unit change limit, however, has a fixed base and synchronizes the first window to it. For example, a 10 secs window started at 18:12:17 has a window start at 18:12:10 and ends therefore at 18:12:20 (exclusive). So this first window is only 13 secs long. The following windows will have full 10 secs. This is useful to synchronize events on fixed base times (full seconds/minutes/hours etc).
A time unit limt can only have one time unit, e.g. it is not possible to chain units like seconds(10).minutes(5).
- Author:
- IIT Software GmbH, Muenster/Germany, (c) 2017, All Rights Reserved
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks the Memory limits and deletes Messages that doesn't fit in the limitdays
(int n) Sets a days time unit limithours
(int n) Sets a hours time unit limitlimit()
Creates a new LimitBuilder and that chains new Limits to the corresponding Memoryminutes
(int n) Sets a minutes time unit limitmonths
(int n) Sets a months time unit limitonRetire
(RetirementCallback callback) Sets a callback which is called for each Message that is retired (removed by a Limit).seconds
(int n) Sets a seconds time unit limittoString()
weeks
(int n) Sets a weeks time unit limityears
(int n) Sets a years time unit limit
-
Constructor Details
-
TimeUnitChangeLimit
Internal use only.
-
-
Method Details
-
seconds
Sets a seconds time unit limit- Parameters:
n
- number of seconds- Returns:
- this
-
minutes
Sets a minutes time unit limit- Parameters:
n
- number of minutes- Returns:
- this
-
hours
Sets a hours time unit limit- Parameters:
n
- number of hours- Returns:
- this
-
days
Sets a days time unit limit- Parameters:
n
- number of days- Returns:
- this
-
weeks
Sets a weeks time unit limit- Parameters:
n
- number of weeks- Returns:
- this
-
months
Sets a months time unit limit- Parameters:
n
- number of months- Returns:
- this
-
years
Sets a years time unit limit- Parameters:
n
- number of years- Returns:
- this
-
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 interfaceLimit
-
onRetire
Description copied from interface:Limit
Sets a callback which is called for each Message that is retired (removed by a Limit). -
limit
Description copied from interface:Limit
Creates a new LimitBuilder and that chains new Limits to the corresponding Memory -
toString
-