title: Stopping an infinite loop Runnable run from ThreadPool
body: <p>I have a <code>Runnable</code> implementing class which will be run from a <code>Executors.newFixedThreadPool</code>
  Inside the <code>Runnable</code>, I have an infinite-loop running which listens on an UDP Port for incoming data.</p>
  
  <p>I want to gracefully end the <code>Runnable</code> in order to close said UDP Ports.</p>
  
  <p>How can I achieve this?
  When extending <code>Thread</code> directly, I have access to interrupt() and isInterupted() etc. on which I can base my infinite loop.</p>
  
  <p>In the <code>Runnable</code> implementing class however, I want to to do something like </p>
  
  <pre><code>@Override
  public void run() {
      while (active) {
  
      }
  }
  </code></pre>
  
  <p>and have </p>
  
  <pre><code>private boolean active = true;
  </code></pre>
  
  <p>How can I set active = false when the ThreadPool is terminated?</p>