Skip to content

Commit

Permalink
Merge pull request #3601 from danielburrell/release-21
Browse files Browse the repository at this point in the history
Migrate deprecated Bucket4J class usage to Bucket class to unblock upgrades
  • Loading branch information
k8s-ci-robot authored Jul 29, 2024
2 parents 1ec7ce7 + 13a0e01 commit 4a706d6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extended/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.github.vladimir-bukhtoyarov</groupId>
<groupId>com.bucket4j</groupId>
<artifactId>bucket4j-core</artifactId>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import io.github.bucket4j.Bandwidth;
import io.github.bucket4j.Bucket4j;
import io.github.bucket4j.Bucket;
import io.github.bucket4j.Refill;
import io.github.bucket4j.local.LocalBucket;
import io.github.bucket4j.local.SynchronizationStrategy;
Expand Down Expand Up @@ -65,7 +65,7 @@ public boolean filter(CoreV1Event event) {

private class SpamRecord {
private LocalBucket tokenBucket =
Bucket4j.builder()
Bucket.builder()
.addLimit(
Bandwidth.classic(
capacity, Refill.greedy(refillingTokensPerPeriod, refillingPeriod)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import io.github.bucket4j.Bandwidth;
import io.github.bucket4j.Bucket;
import io.github.bucket4j.Bucket4j;
import io.github.bucket4j.Refill;
import io.github.bucket4j.local.SynchronizationStrategy;
import java.time.Duration;
Expand All @@ -32,7 +31,7 @@ public BucketRateLimiter(long capacity, long tokensGeneratedInPeriod, Duration p
Bandwidth bandwidth =
Bandwidth.classic(capacity, Refill.greedy(tokensGeneratedInPeriod, period));
this.bucket =
Bucket4j.builder()
Bucket.builder()
.addLimit(bandwidth)
.withSynchronizationStrategy(SynchronizationStrategy.SYNCHRONIZED)
.build();
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<caffeine.version>2.9.3</caffeine.version>
<protobuf.version>4.27.1</protobuf.version>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<bucket4j.version>8.0.1</bucket4j.version>
<bucket4j.version>8.10.1</bucket4j.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
<gson.version>2.11.0</gson.version>
<jackson.version>2.17.1</jackson.version>
Expand Down Expand Up @@ -157,7 +157,7 @@
<version>0.9.6</version>
</dependency>
<dependency>
<groupId>com.github.vladimir-bukhtoyarov</groupId>
<groupId>com.bucket4j</groupId>
<artifactId>bucket4j-core</artifactId>
<version>${bucket4j.version}</version>
</dependency>
Expand Down

0 comments on commit 4a706d6

Please sign in to comment.