> +       * 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

Reply via email to