Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit 359281b

Browse files
fix cancellatin handling
Change-Id: I2a67942d135183c4f0b316e626b578041026c808
1 parent c551838 commit 359281b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/Util.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import java.util.Locale;
6565
import java.util.Map;
6666
import java.util.Optional;
67+
import java.util.concurrent.CancellationException;
6768
import java.util.concurrent.ScheduledExecutorService;
6869
import javax.annotation.Nullable;
6970

@@ -79,6 +80,10 @@ public static Status.Code extractStatus(@Nullable Throwable error) {
7980
if (error == null) {
8081
return Status.Code.OK;
8182
}
83+
// Handle java CancellationException as if it was a gax CancelledException
84+
if (error instanceof CancellationException) {
85+
return Status.Code.CANCELLED;
86+
}
8287
if (error instanceof ApiException) {
8388
ApiException apiException = (ApiException) error;
8489
if (apiException.getStatusCode() instanceof GrpcStatusCode) {

0 commit comments

Comments
 (0)