Skip to content

Commit 1e624a9

Browse files
ejona86Timur Sadykov
andauthored
oauth2_http: Use Futures.getDone() instead of Future.get() in listener (#1109)
Listeners for Futures should generally use Futures.addCallback() or Futures.getDone() when called. This makes it clear they won't block and allows tooling to know it will never block. cl/492555987 Co-authored-by: Timur Sadykov <[email protected]>
1 parent 06bf21a commit 1e624a9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,10 @@ public OAuthValue call() throws Exception {
284284
private void finishRefreshAsync(ListenableFuture<OAuthValue> finishedTask) {
285285
synchronized (lock) {
286286
try {
287-
this.value = finishedTask.get();
287+
this.value = Futures.getDone(finishedTask);
288288
for (CredentialsChangedListener listener : changeListeners) {
289289
listener.onChanged(this);
290290
}
291-
} catch (InterruptedException e) {
292-
Thread.currentThread().interrupt();
293291
} catch (Exception e) {
294292
// noop
295293
} finally {

0 commit comments

Comments
 (0)