title: Java: Force stopping of ExecutorService threads
body: <p>My code:</p>
  
  <pre><code>
  String[] torrentFiles = new File("/root/torrents/").list();
  
          if(torrentFiles.length == 0 || torrentFiles == null)
          {
              System.exit(0);
          }
  
          ex = Executors.newFixedThreadPool(3);
  
          for(String torrentFile : torrentFiles)
          {
              ex.submit(new DownloadTorrent("/root/torrents/" + torrentFile));
          }
  
          ex.shutdown();
  
          try
          {
              ex.awaitTermination(30, TimeUnit.MINUTES);
          }
          catch(InterruptedException ex1)
          {
              Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex1);
          }
  </code></pre>
  
  <p>But sometimes torrent downloading takes unknown time value and «<code>awaitTermination</code>» not works as I want. I need to stop all executed threads instantly after half an hour but as I know «<code>awaitTermination</code>» just only use <code>interrupt()</code> method which works only in loops or waiting. So timeout not works if this moment happens. So, how to?</p>