googleapis / googleapis/google-cloud-java

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

Abierto
#12,508 1 comentario 0 reacciones 0 asignados Ver en GitHub
priority: p2 type: feature request
Lenguaje dominante
Java
Estrellas
2.1k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
154

Descripción

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?)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.