Package com.github.cowwoc.tokenbucket
Class Bucket.ConfigurationUpdater
java.lang.Object
com.github.cowwoc.tokenbucket.Bucket.ConfigurationUpdater
- All Implemented Interfaces:
 AutoCloseable
- Enclosing class:
 - Bucket
 
Updates this Bucket's configuration.
 
Thread-safety: This class is not thread-safe.
- 
Method Summary
Modifier and TypeMethodDescriptionaddLimit(Function<Limit.Builder, Limit> limitBuilder) Adds a limit that the bucket must respect.addListener(ContainerListener listener) Adds an event listener to the bucket.clear()Removes all limits.voidclose()Updates this Bucket's configuration.limits()Returns the limits that the bucket must respect.removeLimit(Limit limit) Removes a limit that the bucket must respect.removeListener(ContainerListener listener) Removes an event listener from the bucket.toString()userData()Returns the user data associated with this bucket.Sets user data associated with this bucket. 
- 
Method Details
- 
limits
Returns the limits that the bucket must respect.- Returns:
 - the limits that the bucket must respect
 - Throws:
 IllegalStateException- if the updater is closed
 - 
addLimit
Adds a limit that the bucket must respect.- Parameters:
 limitBuilder- builds a Limit- Returns:
 - this
 - Throws:
 NullPointerException- iflimitis nullIllegalStateException- if the updater is closed
 - 
removeLimit
Removes a limit that the bucket must respect.- Parameters:
 limit- a limit- Returns:
 - this
 - Throws:
 NullPointerException- iflimitis nullIllegalStateException- if the updater is closed
 - 
clear
Removes all limits.- Returns:
 - this
 - Throws:
 IllegalStateException- if the updater is closed
 - 
addListener
Adds an event listener to the bucket.- Parameters:
 listener- a listener- Returns:
 - this
 - Throws:
 NullPointerException- iflisteneris nullIllegalStateException- if the updater is closed
 - 
removeListener
Removes an event listener from the bucket.- Parameters:
 listener- a listener- Returns:
 - this
 - Throws:
 NullPointerException- iflisteneris nullIllegalStateException- if the updater is closed
 - 
userData
Returns the user data associated with this bucket.- Returns:
 - the data associated with this bucket
 - Throws:
 IllegalStateException- if the updater is closed
 - 
userData
Sets user data associated with this bucket.- Parameters:
 userData- the data associated with this bucket- Returns:
 - this
 - Throws:
 IllegalStateException- if the updater is closed
 - 
close
public void close()Updates this Bucket's configuration.- Specified by:
 closein interfaceAutoCloseable- Throws:
 IllegalArgumentException- iflimitsis empty
 - 
toString
 
 -