title: How to implement a fixed rate poller with ScheduledExecutorService?
body: <p>Given the following class:</p>
  
  <pre><code>public class Poller implements Runnable {
      public static final int CORE_POOL_SIZE = 4;
  
      public boolean running;
      public ScheduledExecutorService ses;
  
      public void startPolling() {
          this.ses = Executors.newScheduledThreadPool(CORE_POOL_SIZE);
          this.ses.scheduleAtFixedRate(this, 0, 1, TimeUnit.SECONDS);
      }
  
      public void run() {
          running = true;
          // ... Do something ...
          running = false;
      }
  }
  </code></pre>
  
  <p>The <code>ScheduledExecutorService</code> has a core thread pool size of 4 but will more than one poller thread ever be created? Since <code>this</code> is passed into <code>scheduleAtFixedRate</code> does that mean there will only ever be one thread - or does something more complex happen behind the scenes?</p>
  
  <p>And 2 bonus questions:-</p>
  
  <ol>
  <li>Should <code>running</code> be <code>static</code>?</li>
  <li>Is <code>CORE_POOL_SIZE</code> redundant?</li>
  </ol>