jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Gaul <notificati...@github.com>
Subject Re: [jclouds] Delete objects in a container efficiently. (#214)
Date Fri, 21 Mar 2014 20:37:03 GMT
> +         // If a future to delete a blob/directory actually got created above,
> +         // keep a reference of that in the outstandingFutures list. This is
> +         // useful in case of a timeout exception. All outstanding futures can
> +         // then be cancelled.
> +         if (blobDelFuture != null) {
> +            final AtomicReference<ListenableFuture<Void>> atomicBlobDelFuture
=
> +               new AtomicReference<ListenableFuture<Void>>(blobDelFuture);
> +            outstandingFutures.add(atomicBlobDelFuture);
> +
> +            // Add a callback to release the semaphore. This is required for
> +            // other threads waiting to acquire a semaphore above to make
> +            // progress.
> +            Futures.addCallback(blobDelFuture, new FutureCallback<Object>() {
> +               @Override
> +               public void onSuccess(final Object o) {
> +                  outstandingFutures.remove(atomicBlobDelFuture);

Can you make outstandingFutures a HashSet to avoid O(n) lookup?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/214/files#r10853439
Mime
View raw message