Skip to content

Commit

Permalink
Remove RemoteGcsHelper exception cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Kannan committed Jan 11, 2016
1 parent 863c572 commit 96c80c0
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ public StorageOptions options() {

/**
* Deletes a bucket, even if non-empty. Objects in the bucket are listed and deleted until bucket
* deletion succeeds or {@code timeout} expires.
* deletion succeeds or {@code timeout} expires. To allow for the timeout, this method uses a
* separate thread to send the delete requests. Use
* {@link #forceDelete(Storage storage, String bucket)} if spawning an additional thread is
* undesirable, such as in the App Engine production runtime.
*
* @param storage the storage service to be used to issue requests
* @param bucket the bucket to be deleted
Expand All @@ -89,20 +92,14 @@ public static Boolean forceDelete(Storage storage, String bucket, long timeout,
}

/**
* Deletes a bucket, even if non-empty. Objects in the bucket are listed and deleted until bucket
* deletion succeeds. This method can be used to delete buckets from within App Engine. Note that
* this method does not set a timeout.
* Deletes a bucket, even if non-empty. This method blocks until the deletion completes or fails.
*
* @param storage the storage service to be used to issue requests
* @param bucket the bucket to be deleted
* @throws StorageException if an exception is encountered during bucket deletion
*/
public static void forceDelete(Storage storage, String bucket) throws StorageException {
try {
new DeleteBucketTask(storage, bucket).call();
} catch (Exception e) {
throw (StorageException) e;
}
public static void forceDelete(Storage storage, String bucket) throws InterruptedException {
new DeleteBucketTask(storage, bucket).call();
}

/**
Expand Down Expand Up @@ -174,7 +171,7 @@ public DeleteBucketTask(Storage storage, String bucket) {
}

@Override
public Boolean call() throws Exception {
public Boolean call() throws InterruptedException {
while (true) {
for (BlobInfo info : storage.list(bucket).values()) {
storage.delete(bucket, info.name());
Expand Down

0 comments on commit 96c80c0

Please sign in to comment.