Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1442 from maginatics/clear-container-parameterize…
Browse files Browse the repository at this point in the history
…-max-errors

Parameterize max errors for clear container
  • Loading branch information
mattstep committed Apr 1, 2013
2 parents acc8949 + 15f4d04 commit f0a1054
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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());
}
Expand All @@ -89,7 +101,6 @@ public void execute(final String containerName, ListContainerOptions options) {
message += " recursively";
logger.debug(message);
Map<StorageMetadata, Exception> exceptions = Maps.newHashMap();
int maxErrors = 3; // TODO parameterize
for (int numErrors = 0; numErrors < maxErrors; ) {
// fetch partial directory listing
PageSet<? extends StorageMetadata> listing;
Expand Down

0 comments on commit f0a1054

Please sign in to comment.