From ad87c596d94b0ce9a0869c042f33bfee269b9334 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Wed, 19 Sep 2012 15:54:31 -0700 Subject: [PATCH] Avoid Futures.getUnchecked in DeleteAllKeysInList This masks InterruptedException. We should rework the logic in execute to unwind the stack on errors; currently we only return from the leaf method. --- .../blobstore/strategy/internal/DeleteAllKeysInList.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInList.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInList.java index 87d58ae43d..b3221a2775 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInList.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/DeleteAllKeysInList.java @@ -22,6 +22,7 @@ import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursi import static org.jclouds.concurrent.FutureIterables.awaitCompletion; import java.util.Map; +import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -95,8 +96,11 @@ public class DeleteAllKeysInList implements ClearListStrategy, ClearContainerStr for (int i = 0; i < maxErrors; ) { // fetch partial directory listing try { - listing = Futures.getUnchecked(connection.list(containerName, options)); - } catch (RuntimeException ee) { + listing = connection.list(containerName, options).get(); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + break; + } catch (ExecutionException ee) { ++i; if (i == maxErrors) { throw Throwables.propagate(ee.getCause());