Skip to content

Is there an infinite capacity and zero capacity bucket available for testing? #347

Answered by vladimir-bukhtoyarov
etnoy asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @etnoy

It is not possible to achive via builder but, can be simulated in the following way:

Effectively empty:

Bucket bucket = ...;
bucket.consumeIgnoringRateLimits(Long.MAX_VALUE / 2);
System.out.println(bucket.getAvailableTokens());

Effectively infinite:

Bucket bucket = ...;
bucket.forceAddTokens(Long.MAX_VALUE / 2);
System.out.println(bucket.getAvailableTokens());

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vladimir-bukhtoyarov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants