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 longgetLastUpdateTime()LonggetMinValue()Longpeek()MaxPeriodical.Data<Long>peek(long timestamp)List<MaxPeriodical.Data<Long>>peek(long since, long till)voidpersist(long timestamp)MaxPeriodical.Data<Long>reset(long timestamp)Sets current maximum to minimal value (seeMaxPeriodical.getMinValue()) and start new periodbooleanupdate(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:MaxPeriodicalSets current maximum to minimal value (seeMaxPeriodical.getMinValue()) and start new period- Specified by:
resetin interfaceMaxPeriodical<Long>- Returns:
-
persist
public void persist(long timestamp)
-
update
public boolean update(@NotNull Long currentValue, long timestamp)Description copied from interface:MaxPeriodicalUpdates current maximum if provided value is greater than currentMaxPeriodical.peek()and if provided timestamp is not less thanMaxPeriodical.getLastUpdateTime()- Specified by:
updatein interfaceMaxPeriodical<Long>- Parameters:
currentValue- value to settimestamp- current timestamp- Returns:
- true if current maximum was updated
-
getMinValue
@NotNull public Long getMinValue()
- Specified by:
getMinValuein interfaceMaxPeriodical<Long>- Returns:
- minimal value of this metric
-
peek
@NotNull public List<MaxPeriodical.Data<Long>> peek(long since, long till)
- Specified by:
peekin 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:
peekin interfaceMaxPeriodical<Long>- Returns:
- current maximum
-
peek
@NotNull public MaxPeriodical.Data<Long> peek(long timestamp)
- Specified by:
peekin interfaceMaxPeriodical<Long>- Returns:
- current maximum with range data (since last reset till passed timestamp)
-
getLastUpdateTime
public long getLastUpdateTime()
- Specified by:
getLastUpdateTimein interfaceMaxPeriodical<Long>- Returns:
- timestamp of last update
-
-