Package org.infinispan.counter.api
Class CounterConfiguration.Builder
- java.lang.Object
-
- org.infinispan.counter.api.CounterConfiguration.Builder
-
- Enclosing class:
- CounterConfiguration
public static class CounterConfiguration.Builder extends Object
The builder ofCounterConfiguration
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CounterConfiguration
build()
CounterConfiguration.Builder
concurrencyLevel(int concurrencyLevel)
Sets the concurrency level of the counter.CounterConfiguration.Builder
initialValue(long initialValue)
Sets the initial value.CounterConfiguration.Builder
lowerBound(long lowerBound)
Sets the lower bound (inclusive) of the counter.CounterConfiguration.Builder
storage(Storage storage)
Sets the storage mode of the counter.CounterConfiguration.Builder
upperBound(long upperBound)
Sets the upper bound (inclusive) of the counter.
-
-
-
Method Detail
-
initialValue
public CounterConfiguration.Builder initialValue(long initialValue)
Sets the initial value.The default value is zero.
- Parameters:
initialValue
- the new initial value.
-
lowerBound
public CounterConfiguration.Builder lowerBound(long lowerBound)
Sets the lower bound (inclusive) of the counter.Only for
CounterType.BOUNDED_STRONG
counters.The default value is
Long.MIN_VALUE
.- Parameters:
lowerBound
- the new lower bound.
-
upperBound
public CounterConfiguration.Builder upperBound(long upperBound)
Sets the upper bound (inclusive) of the counter.Only for
CounterType.BOUNDED_STRONG
counters.The default value is
Long.MAX_VALUE
.- Parameters:
upperBound
- the new upper bound.
-
storage
public CounterConfiguration.Builder storage(Storage storage)
Sets the storage mode of the counter.The default value is
Storage.VOLATILE
.- Parameters:
storage
- the new storage mode.- See Also:
Storage
-
concurrencyLevel
public CounterConfiguration.Builder concurrencyLevel(int concurrencyLevel)
Sets the concurrency level of the counter.Only for
CounterType.WEAK
.The concurrency level set the amount of concurrent updates that can happen simultaneous. It is trade-off between the write performance and read performance. A higher value will allow more concurrent updates, however it will take more time to compute the counter value.
The default value is 64.
- Parameters:
concurrencyLevel
- the new concurrency level.
-
build
public CounterConfiguration build()
- Returns:
- the
CounterConfiguration
with this configuration.
-
-