title: Java difference between fixed threadpool and scheduled threadpool
body: <p>I have a fixed thread pool that runs 7 concurrent threads at any time (with a queue), and I want to turn it into a scheduled thread pool that runs only 7 concurrent jobs but can queue/schedule more.</p>
  
  <p>Reading the documentation didn't really help me..</p>
  
  <p><a href="http://download.oracle.com/javase/1,5.0/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)" rel="noreferrer"><strong>newFixedThreadPool</strong></a></p>
  
  <blockquote>
    <p>public static ExecutorService newFixedThreadPool(int nThreads)</p>
    
    <p>Creates a thread pool that reuses a fixed set of threads operating off
    a shared unbounded queue. If any thread terminates due to a failure
    during execution prior to shutdown, a new one will take its place if
    needed to execute subsequent tasks.</p>
    
    <p>Parameters:
        nThreads - the number of threads in the pool  Returns:
        the newly created thread pool</p>
  </blockquote>
  
  <p><a href="http://download.oracle.com/javase/1,5.0/docs/api/java/util/concurrent/Executors.html#newScheduledThreadPool(int)" rel="noreferrer"><strong>newScheduledThreadPool</strong></a></p>
  
  <blockquote>
    <p>public static ScheduledExecutorService newScheduledThreadPool(int
    corePoolSize)</p>
    
    <p>Creates a thread pool that can schedule commands to run after a given
    delay, or to execute periodically.</p>
    
    <p>Parameters:
        corePoolSize - the number of threads to keep in the pool, even if they are idle.  Returns:
        a newly created scheduled thread pool</p>
  </blockquote>
  
  <p>What I don't understand is, are corePoolSize and nThreads the same thing? Is a scheduled thread pool really a subset of a fixed thread pool, meaning that I can use scheduled thread pool as a fixed thread pool that can queue delayed tasks?</p>