File tree Expand file tree Collapse file tree
java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5266,7 +5266,7 @@ private void loadDriverVersionProperties() {
52665266 }
52675267 }
52685268
5269- // TODO(developer ): This is a temporary compatibility bridge to wrap raw Threads into Futures.
5269+ // TODO(keshav ): This is a temporary compatibility bridge to wrap raw Threads into Futures.
52705270 // This should be removed when BigQueryDatabaseMetaData is refactored to use the ExecutorService
52715271 // directly.
52725272 private static Future <?>[] wrapThread (final Thread thread ) {
@@ -5275,8 +5275,14 @@ private static Future<?>[] wrapThread(final Thread thread) {
52755275 }
52765276 return new Future <?>[] {
52775277 new Future <Object >() {
5278+ private volatile boolean cancelled = false ;
5279+
52785280 @ Override
52795281 public boolean cancel (boolean mayInterruptIfRunning ) {
5282+ if (cancelled || !thread .isAlive ()) {
5283+ return false ;
5284+ }
5285+ cancelled = true ;
52805286 if (mayInterruptIfRunning ) {
52815287 thread .interrupt ();
52825288 }
@@ -5285,12 +5291,12 @@ public boolean cancel(boolean mayInterruptIfRunning) {
52855291
52865292 @ Override
52875293 public boolean isCancelled () {
5288- return false ;
5294+ return cancelled ;
52895295 }
52905296
52915297 @ Override
52925298 public boolean isDone () {
5293- return !thread .isAlive ();
5299+ return cancelled || !thread .isAlive ();
52945300 }
52955301
52965302 @ Override
You can’t perform that action at this time.
0 commit comments