Skip to content

Commit

Permalink
Making token fetch thread safe
Browse files Browse the repository at this point in the history
  • Loading branch information
AsabuHere committed Jun 21, 2024
1 parent c046ba6 commit fd9731a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public Response request(BearerTokenRequest request) {

if (accessToken == null || accessToken.isEmpty() || isTokenExpired(this.accessToken)) {
synchronized (BearerTokenTwilioRestClient.class){
this.accessToken = tokenManager.fetchAccessToken();
if (accessToken == null || accessToken.isEmpty() || isTokenExpired(this.accessToken)) {
this.accessToken = tokenManager.fetchAccessToken();
}
}
}

Expand Down

0 comments on commit fd9731a

Please sign in to comment.