prevent concurrent token read / refresh (#4686)

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
Andrew Fiddian-Green
2025-03-29 18:09:33 +01:00
committed by GitHub
parent 0f354e63f3
commit 1960646a6d
@@ -291,7 +291,7 @@ public class OAuthClientServiceImpl implements OAuthClientService {
}
@Override
public AccessTokenResponse refreshToken() throws OAuthException, IOException, OAuthResponseException {
public synchronized AccessTokenResponse refreshToken() throws OAuthException, IOException, OAuthResponseException {
if (isClosed()) {
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);
}
@@ -333,7 +333,7 @@ public class OAuthClientServiceImpl implements OAuthClientService {
}
@Override
public @Nullable AccessTokenResponse getAccessTokenResponse()
public synchronized @Nullable AccessTokenResponse getAccessTokenResponse()
throws OAuthException, IOException, OAuthResponseException {
if (isClosed()) {
throw new OAuthException(EXCEPTION_MESSAGE_CLOSED);