googleapis / googleapis/google-cloud-java

[sdk-platform-java] ApiExceptions.callAndTranslateApiException should be interruptible

オープン
#12,508 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
priority: p2 type: feature request
主要言語
Java
スター
2.1k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
154

説明

ApiExceptions.callAndTranslateApiException is used to adapt async calls to sync calls. For example its used here:
https://github.com/googleapis/gapic-generator-java/blob/c23f981e2ac3c573bed51e725dc7061551179400/gax-java/gax/src/main/java/com/google/api/gax/rpc/UnaryCallable.java#L99-L101

To accomplish this callAndTranslateApiException uses guava's Futures.getUnchecked() function. This function will swallow/ignore thread interruptions, and continue to wait on the underlying future. This prevents end users from cancelling RPCs from a sync call convention. I think a much better approach would be to catch the interruption and cancel the underlying future and re-throw an error (maybe gax's CancelledException?)

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。