title: Does invokeAny cancel all the threads in a Thread pool or only callables?
body: <p>I'm creating a fixed size <code>ExecutorService</code>, which is going to be accessed from multiple threads. </p>
  
  <pre><code>ExecutorService executorService = Executors.newFixedThreadPool(2);
  </code></pre>
  
  <p>Then I'm calling <code>invokeAny</code> from two different threads using the same <code>ExecutorService</code>.</p>
  
  <pre><code>executorService.invokeAny(listCallables);
  </code></pre>
  
  <p>So there is a possibility that in the thread pool there can be multiple tasks called from different threads.</p>
  
  <p>As per the <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html#invokeAny(java.util.Collection)" rel="nofollow noreferrer">invokeAny</a> documentation: </p>
  
  <blockquote>
    <p>Upon normal or exceptional return, tasks that have not completed are cancelled.</p>
  </blockquote>
  
  <p>My question is, upon successful return of <code>invokeAny</code>, will it cancel all the threads which are in the thread pool or will it cancel only the tasks which are called in separate threads? </p>