From 8a9f799cd67a233cd0cbd32fca610e4d5aec7d49 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges <110673802+mitchhentgesspotify@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:38:10 +0200 Subject: [PATCH] Store `installationTokens` in a `ConcurrentHashMap` (#195) Hopefully this is sufficient to make `GitHubClient` thread-safe. No other usages of `HashMap` or `ArrayList` were found, except for `Languages` which is a return structure, so is less necessary to be thread-safe. --- src/main/java/com/spotify/github/v3/clients/GitHubClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/spotify/github/v3/clients/GitHubClient.java b/src/main/java/com/spotify/github/v3/clients/GitHubClient.java index 81a72bf9..8f41df5e 100644 --- a/src/main/java/com/spotify/github/v3/clients/GitHubClient.java +++ b/src/main/java/com/spotify/github/v3/clients/GitHubClient.java @@ -48,12 +48,12 @@ import java.lang.invoke.MethodHandles; import java.net.URI; import java.time.ZonedDateTime; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import javax.ws.rs.core.HttpHeaders; @@ -145,7 +145,7 @@ private GitHubClient( this.privateKey = privateKey; this.appId = appId; this.installationId = installationId; - this.installationTokens = new HashMap<>(); + this.installationTokens = new ConcurrentHashMap<>(); } /**