Class StoredMaxPeriodical
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.serverStatistics.StoredMaxPeriodical
-
- All Implemented Interfaces:
MaxPeriodical<Long>
public class StoredMaxPeriodical extends Object implements MaxPeriodical<Long>
Created by Andrey Titov on 1/30/17. A maximum periodical metric storing old values in the database.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.impl.serverStatistics.MaxPeriodical
MaxPeriodical.Data<T extends Comparable<T>>
-
-
Constructor Summary
Constructors Constructor Description StoredMaxPeriodical(long timestamp, long minValue, ServerStatisticsStorage serverStatisticsStorage, ServerStatisticsStorage.Key key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getLastUpdateTime()
Long
getMinValue()
Long
peek()
MaxPeriodical.Data<Long>
peek(long timestamp)
List<MaxPeriodical.Data<Long>>
peek(long since, long till)
void
persist(long timestamp)
MaxPeriodical.Data<Long>
reset(long timestamp)
Sets current maximum to minimal value (seeMaxPeriodical.getMinValue()
) and start new periodboolean
update(Long currentValue, long timestamp)
Updates current maximum if provided value is greater than currentMaxPeriodical.peek()
and if provided timestamp is not less thanMaxPeriodical.getLastUpdateTime()
-
-
-
Constructor Detail
-
StoredMaxPeriodical
public StoredMaxPeriodical(long timestamp, long minValue, @NotNull ServerStatisticsStorage serverStatisticsStorage, @NotNull ServerStatisticsStorage.Key key)
-
-
Method Detail
-
reset
public MaxPeriodical.Data<Long> reset(long timestamp)
Description copied from interface:MaxPeriodical
Sets current maximum to minimal value (seeMaxPeriodical.getMinValue()
) and start new period- Specified by:
reset
in interfaceMaxPeriodical<Long>
- Returns:
-
persist
public void persist(long timestamp)
-
update
public boolean update(@NotNull Long currentValue, long timestamp)
Description copied from interface:MaxPeriodical
Updates current maximum if provided value is greater than currentMaxPeriodical.peek()
and if provided timestamp is not less thanMaxPeriodical.getLastUpdateTime()
- Specified by:
update
in interfaceMaxPeriodical<Long>
- Parameters:
currentValue
- value to settimestamp
- current timestamp- Returns:
- true if current maximum was updated
-
getMinValue
@NotNull public Long getMinValue()
- Specified by:
getMinValue
in interfaceMaxPeriodical<Long>
- Returns:
- minimal value of this metric
-
peek
@NotNull public List<MaxPeriodical.Data<Long>> peek(long since, long till)
- Specified by:
peek
in interfaceMaxPeriodical<Long>
- Parameters:
since
- start of the rangetill
- end of the range- Returns:
- A list of available maximums. Empty list if the range is not available.
-
peek
@NotNull public Long peek()
- Specified by:
peek
in interfaceMaxPeriodical<Long>
- Returns:
- current maximum
-
peek
@NotNull public MaxPeriodical.Data<Long> peek(long timestamp)
- Specified by:
peek
in interfaceMaxPeriodical<Long>
- Returns:
- current maximum with range data (since last reset till passed timestamp)
-
getLastUpdateTime
public long getLastUpdateTime()
- Specified by:
getLastUpdateTime
in interfaceMaxPeriodical<Long>
- Returns:
- timestamp of last update
-
-