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 7da98da1a6..1824abd4fd 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 @@ -63,10 +63,12 @@ public class DeleteAllKeysInList implements ClearListStrategy, ClearContainerStr private final ListeningExecutorService userExecutor; protected final AsyncBlobStore connection; + /** Maximum duration in milliseconds of a request. */ - @Inject(optional = true) - @Named(Constants.PROPERTY_REQUEST_TIMEOUT) - protected Long maxTime = Long.MAX_VALUE; + protected long maxTime = Long.MAX_VALUE; + + /** Maximum times to retry an operation. */ + protected int maxErrors = 3; @Inject DeleteAllKeysInList(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, @@ -76,6 +78,16 @@ public class DeleteAllKeysInList implements ClearListStrategy, ClearContainerStr this.retryHandler = retryHandler; } + @Inject(optional = true) + void setMaxTime(@Named(Constants.PROPERTY_REQUEST_TIMEOUT) long maxTime) { + this.maxTime = maxTime; + } + + @Inject(optional = true) + void setMaxErrors(@Named(Constants.PROPERTY_MAX_RETRIES) int maxErrors) { + this.maxErrors = maxErrors; + } + public void execute(String containerName) { execute(containerName, recursive()); } @@ -89,7 +101,6 @@ public void execute(final String containerName, ListContainerOptions options) { message += " recursively"; logger.debug(message); Map exceptions = Maps.newHashMap(); - int maxErrors = 3; // TODO parameterize for (int numErrors = 0; numErrors < maxErrors; ) { // fetch partial directory listing PageSet listing;