From b68001e08530e50dc5579b0bc7d287ab9c16e5c0 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Wed, 19 Sep 2012 13:29:16 -0700 Subject: [PATCH 1/2] Fix deleteAndVerifyContainerGone return value Return true if the container does not exist -- this matches the behavior of Atmos and Swift. This allows deleteAndEnsurePathGone to terminate correctly with S3. --- apis/s3/src/main/java/org/jclouds/s3/util/S3Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/s3/src/main/java/org/jclouds/s3/util/S3Utils.java b/apis/s3/src/main/java/org/jclouds/s3/util/S3Utils.java index 43928bfee4..0f4cb16734 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/util/S3Utils.java +++ b/apis/s3/src/main/java/org/jclouds/s3/util/S3Utils.java @@ -62,7 +62,7 @@ public class S3Utils { */ public static boolean deleteAndVerifyContainerGone(S3Client sync, String container) { sync.deleteBucketIfEmpty(container); - return sync.bucketExists(container); + return !sync.bucketExists(container); } private static final Predicate ANNOTATIONTYPE_BUCKET = new Predicate() { From a70ba3f986830c552d8b5c21145e46a90edd7f40 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Wed, 19 Sep 2012 15:54:31 -0700 Subject: [PATCH 2/2] 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());