Package org.infinispan.counter.util
Class Utils
- java.lang.Object
-
- org.infinispan.counter.util.Utils
-
public final class Utils extends Object
Utility methods.- Since:
- 9.0
- Author:
- Pedro Ruivo
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CounterStatecalculateState(long value, long lowerBound, long upperBound)Calculates theCounterStateto use based on the value and the boundaries.static Param.PersistenceModegetPersistenceMode(Storage storage)static voidvalidateStrongCounterBounds(long lowerBound, long initialValue, long upperBound)Validates the lower and upper bound for a strong counter.
-
-
-
Method Detail
-
validateStrongCounterBounds
public static void validateStrongCounterBounds(long lowerBound, long initialValue, long upperBound)Validates the lower and upper bound for a strong counter.It throws a
CounterConfigurationExceptionis not valid.- Parameters:
lowerBound- The counter's lower bound value.initialValue- The counter's initial value.upperBound- The counter's upper bound value.- Throws:
CounterConfigurationException- if the upper or lower bound aren't valid.
-
calculateState
public static CounterState calculateState(long value, long lowerBound, long upperBound)
Calculates theCounterStateto use based on the value and the boundaries.If the value is less than the lower bound,
CounterState.LOWER_BOUND_REACHEDis returned. On other hand, if the value is higher than the upper bound,CounterState.UPPER_BOUND_REACHEDis returned. Otherwise,CounterState.VALIDis returned.- Parameters:
value- the value to check.lowerBound- the lower bound.upperBound- the upper bound.- Returns:
- the
CounterState.
-
getPersistenceMode
public static Param.PersistenceMode getPersistenceMode(Storage storage)
-
-