Package org.apache.bookkeeper.client
Class WeightedRandomSelectionImpl<T>
java.lang.Object
org.apache.bookkeeper.client.WeightedRandomSelectionImpl<T>
- All Implemented Interfaces:
WeightedRandomSelection<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.bookkeeper.client.WeightedRandomSelection
WeightedRandomSelection.WeightedObject -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final org.slf4j.Logger(package private) Map<T,WeightedRandomSelection.WeightedObject> (package private) int(package private) Double(package private) ReadWriteLock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetNextRandom(Collection<T> selectedNodes) voidsetMaxProbabilityMultiplier(int max) void
-
Field Details
-
LOG
static final org.slf4j.Logger LOG -
randomMax
Double randomMax -
maxProbabilityMultiplier
int maxProbabilityMultiplier -
map
-
cumulativeMap
-
rwLock
ReadWriteLock rwLock
-
-
Constructor Details
-
WeightedRandomSelectionImpl
WeightedRandomSelectionImpl() -
WeightedRandomSelectionImpl
WeightedRandomSelectionImpl(int maxMultiplier)
-
-
Method Details
-
updateMap
- Specified by:
updateMapin interfaceWeightedRandomSelection<T>
-
getNextRandom
- Specified by:
getNextRandomin interfaceWeightedRandomSelection<T>
-
setMaxProbabilityMultiplier
public void setMaxProbabilityMultiplier(int max) - Specified by:
setMaxProbabilityMultiplierin interfaceWeightedRandomSelection<T>
-
getNextRandom
- Specified by:
getNextRandomin interfaceWeightedRandomSelection<T>
-