java.lang.Object
com.github.cowwoc.tokenbucket.internal.AbstractContainer
com.github.cowwoc.tokenbucket.ContainerList
- All Implemented Interfaces:
 Container
public final class ContainerList
extends com.github.cowwoc.tokenbucket.internal.AbstractContainer
A container of one or more children containers.
 
For example, this allows to consume tokens from a list of buckets.
Thread safety: This class is thread-safe.
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds a ContainerList.final classUpdates this ContainerList's configuration. - 
Method Summary
Modifier and TypeMethodDescriptionstatic ContainerList.Builderbuilder()Builds a bucket that contains children buckets.intsize()Returns the number of children in this list.toString()Updates this list's configuration.Methods inherited from class com.github.cowwoc.tokenbucket.internal.AbstractContainer
consume, consume, consume, getChildren, getListeners, getUserData, tryConsume, tryConsume, tryConsume, tryConsume, tryConsume 
- 
Method Details
- 
builder
Builds a bucket that contains children buckets.By default, the list will delegate to the first child that has sufficient number of tokens available.
- Returns:
 - a new ContainerList builder
 
 - 
size
public int size()Returns the number of children in this list. If this list contains more thanInteger.MAX_VALUEchildren, returnsInteger.MAX_VALUE.- Returns:
 - the number of children in this list
 
 - 
toString
 - 
updateConfiguration
Updates this list's configuration.The
ContainerListwill be locked untilContainerList.ConfigurationUpdater.close()is invoked.- Returns:
 - the configuration updater
 
 
 -