Interface TokenBucket.Builder
-
- All Known Implementing Classes:
DefaultTokenBucket.Builder
- Enclosing interface:
- TokenBucket
public static interface TokenBucket.Builder
Token bucket builder.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TokenBucket
build()
Builds the token bucket based on the specified parameters when possible.TokenBucket.Builder
withAction(TokenBucket.Action action)
Assigns the action to this token bucket.TokenBucket.Builder
withBurstSize(long burstSize)
Assigns the burst size to this token bucket.TokenBucket.Builder
withDscp(short dscp)
Assigns the dscp value to this token bucket.TokenBucket.Builder
withRate(long rate)
Assigns the rate to this token bucket.TokenBucket.Builder
withType(TokenBucket.Type type)
Assigns the type to this token bucket.
-
-
-
Method Detail
-
withRate
TokenBucket.Builder withRate(long rate)
Assigns the rate to this token bucket.- Parameters:
rate
- a rate value- Returns:
- this
-
withBurstSize
TokenBucket.Builder withBurstSize(long burstSize)
Assigns the burst size to this token bucket. Default to 2 * 1500 bytes.- Parameters:
burstSize
- a burst size- Returns:
- this
-
withAction
TokenBucket.Builder withAction(TokenBucket.Action action)
Assigns the action to this token bucket.Note: mandatory setter for this builder
- Parameters:
action
- an action- Returns:
- this
-
withDscp
TokenBucket.Builder withDscp(short dscp)
Assigns the dscp value to this token bucket.- Parameters:
dscp
- a dscp value- Returns:
- this
-
withType
TokenBucket.Builder withType(TokenBucket.Type type)
Assigns the type to this token bucket.Note: mandatory setter for this builder
- Parameters:
type
- the type- Returns:
- this
-
build
TokenBucket build()
Builds the token bucket based on the specified parameters when possible.- Returns:
- a token bucket
-
-