File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
main/java/com/google/cloud/spanner/jdbc
test/java/com/google/cloud/spanner/jdbc Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 1616
1717package com .google .cloud .spanner .jdbc ;
1818
19+ import com .google .cloud .spanner .ErrorCode ;
1920import com .google .cloud .spanner .Options ;
2021import com .google .cloud .spanner .Options .QueryOption ;
2122import com .google .cloud .spanner .ReadContext .QueryAnalyzeMode ;
@@ -259,6 +260,11 @@ private <T> T doWithStatementTimeout(
259260 connection .recordClientLibLatencyMetric (executionDuration .toMillis ());
260261 return result ;
261262 } catch (SpannerException spannerException ) {
263+ if (spannerException .getErrorCode () == ErrorCode .CANCELLED && this .executingLock != null ) {
264+ // Clear the interrupted flag of the thread.
265+ //noinspection ResultOfMethodCallIgnored
266+ Thread .interrupted ();
267+ }
262268 throw JdbcSqlExceptionFactory .of (spannerException );
263269 } finally {
264270 if (this .executingLock != null ) {
Original file line number Diff line number Diff line change @@ -161,7 +161,6 @@ public void testCancel() throws Exception {
161161 message instanceof ExecuteSqlRequest
162162 && ((ExecuteSqlRequest ) message ).getSql ().equals (sql ),
163163 5000L );
164- System .out .println ("Cancelling statement" );
165164 statement .cancel ();
166165 return null ;
167166 });
You can’t perform that action at this time.
0 commit comments