public class TableRollingStrategy extends Object
TableRollingStrategy class
is very much optimized for less memory allocation when we need to determine table extension for a given timestamp in
high frequency. So, for high frequency usage, create a single instance of TableRollingStrategy and use that
again and again.| Modifier and Type | Field and Description |
|---|---|
static int |
DAILY
if
value is 1
Each day will have a new table. |
static int |
HOURLY
extension will be
DATE_FORMAT_StartHour_to_EndHour |
static int |
MONTHLY
if
value is 1
Each month will have a new table. |
static int |
WEEKLY
if
value is 1
Each week will have a new table. |
| Constructor and Description |
|---|
TableRollingStrategy() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getAllExtension(String dateFormat,
String startTime,
String endTime)
Get the list of extensions from the given timestamp range.
|
List<String> |
getAllExtensions(long startTimestamp,
long endTimestamp)
Get the list of extensions from the given timestamp range.
|
String |
getTableExtension(Calendar calendar)
Get the extension string for the given time in the calendar based on this
TableRollingStrategy
Extension can be |
String |
getTableExtension(long timestamp)
Get the extension string for the given time in the calendar based on this
TableRollingStrategy
Extension can be |
int |
getUnit() |
int |
getValue() |
long |
maximumTimeForTable(String tableExtension)
Get the maximum time in long timestamp format for the given table extension.
|
long |
minimumTimeForTable(String tableExtension)
Get the minimum time in long timestamp format for the given table extension.
|
void |
setUnit(int unit) |
void |
setValue(int value) |
public static final int MONTHLY
value is 1
Each month will have a new table.
extension will be MONTH_FORMAT
else if value is greater than 1,
extension will be MONTH_FORMAT_to_MONTH_FORMATpublic static final int WEEKLY
value is 1
Each week will have a new table.
extension will be YEAR_FORMAT_week_weekValue
else if value is greater than 1,
extension will be YEAR_FORMAT_week_weekValueStart_to_YEAR_FORMAT_week_weekValueEndpublic static final int DAILY
value is 1
Each day will have a new table.
extension will be DATE_FORMAT
else if value is greater than 1,
extension will be DATE_FORMAT_to_DATE_FORMATpublic static final int HOURLY
DATE_FORMAT_StartHour_to_EndHourpublic int getValue()
public void setValue(int value)
public int getUnit()
public void setUnit(int unit)
public String getTableExtension(Calendar calendar)
TableRollingStrategy
Extension can becalendar - contains the time which is used to get the extension.public String getTableExtension(long timestamp)
TableRollingStrategy
Extension can betimestamp - the time which is used to get the extension.public List<String> getAllExtensions(long startTimestamp, long endTimestamp)
startTimestamp - Starting timestamp of the range.endTimestamp - End timestamp of the range.public List<String> getAllExtension(String dateFormat, String startTime, String endTime)
dateFormat - start and end time will be parsed using this format.startTime - Starting time in the given format of the range.endTime - End time in the given format of the range.public long minimumTimeForTable(String tableExtension)
TableRollingStrategytableExtension - only the extension part of the table. Consider that a full tame name is
baseTable_tableExtension. This parameter should be only the part that defines tableExtensionpublic long maximumTimeForTable(String tableExtension)
TableRollingStrategytableExtension - only the extension part of the table. Consider that a full tame name is
baseTable_tableExtension. This parameter should be only the part that defines tableExtensionCopyright © 2022. All rights reserved.