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:40:46 GMT
> +       * acquired in 'maxTime', a TimeoutException is thrown. Any outstanding
> +       * futures at that time are cancelled.
> +       */
> +      final Semaphore semaphore = new Semaphore(numOutStandingRequests);
> +      /*
> +       * When a future is created, a reference for that is added to the
> +       * outstandingFutures list. This reference is removed from the list in the
> +       * FutureCallback since it no longer needs to be cancelled in the event of
> +       * a timeout. Also, when the reference is removed from this list and when
> +       * the executorService removes the reference that it has maintained, the
> +       * future will be marked for GC since there should be no other references
> +       * to it. This is important because this code can generate an unbounded
> +       * number of futures.
> +       */
> +      final List<AtomicReference<ListenableFuture<Void>>> outstandingFutures
= Collections
> +            .synchronizedList(new ArrayList<AtomicReference<ListenableFuture<Void>>>());

Does the AtomicReference provide value that the synchronized wrapper does not?

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