Package com.github.gpluscb.ggjava.api
Class RateLimiter.BucketBuilder
- java.lang.Object
-
- com.github.gpluscb.ggjava.api.RateLimiter.BucketBuilder
-
- Enclosing interface:
- RateLimiter
public static class RateLimiter.BucketBuilder extends java.lang.ObjectUsed for building instances of RateLimiter that respect a bucket system.- See Also:
RateLimiter.bucketBuilder()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RateLimiterbuild()Builds the RateLimiter instance.RateLimiter.BucketBuilderperiod(java.lang.Long period)Sets the period according to which tasks will be scheduled.RateLimiter.BucketBuildertasksPerPeriod(java.lang.Integer tasksPerPeriod)Sets the maximum amount of tasks that will be executed in a given period.
-
-
-
Method Detail
-
tasksPerPeriod
@Nonnull public RateLimiter.BucketBuilder tasksPerPeriod(@Nonnegative @Nullable java.lang.Integer tasksPerPeriod)
Sets the maximum amount of tasks that will be executed in a given period.- Parameters:
tasksPerPeriod- the maximum amount of tasks per period or null- Returns:
- itself for chaining
- Throws:
java.lang.IllegalArgumentException- if tasksPerPeriod is negative
-
period
@Nonnull public RateLimiter.BucketBuilder period(@Nonnegative @Nullable java.lang.Long period)
Sets the period according to which tasks will be scheduled.- Parameters:
period- the period according to which tasks will be executed or null- Returns:
- itself for chaining
- Throws:
java.lang.IllegalArgumentException- if period is negative
-
build
@Nonnull public RateLimiter build()
Builds the RateLimiter instance.- Returns:
- the RateLimiter instance
-
-