title: Is this the right way for using ThreadPoolExecutor?
body: <p>I am trying to get thread pool executor to work, and am just wondering if I have gone wrong somewhere with the following code:</p>
  
  <pre><code>public class testPool implements Runnable {
  
      static Executor pooledExecutor = null;
      private Threat thread = null;
  
      private testPool(int minThreadPoolSize,
                       int initThreadPoolSize,
                       int maxThreadPoolSize,
                       int threadKeepAliveTime,
                       int queueCapacity) throws Exception {
  
          pooledExecutor = new ThreadPoolExecutor(initThreadPoolSize,
                                      maxThreadPoolSize,
                                      (long) (1000 * threadKeepAliveTime),
                                      TimeUnit.MILLISECONDS,
                                      new LinkedBlockingQueue&lt;Runnable&gt;(queueCapacity));
  
          this.thread = new Thread(this);
          this.thread.setName("testThread");
  
          try {
                this.thread.setDaemon(true);
          } catch (Exception e) {
             // DO Something
          }
      }
  
      public void run() {
           while(true){
              try {
                  // code to get a testobject
                  pooledExecutor.execute(testObject);
               } catch (Exception e) {
                   //Do something
               } finally {
                //if shutdown parameter is true
                break
              }
            }
        }
  
   }
  </code></pre>
  
  <p>Basically, I am not sure if this implementation will actually create the threads? or do I need to use a thread factory? Before I was using a pooledexecuter, which had a createThreads() method, but I cannot see anything like this.</p>
  
  <p>Also is there any reason why someone would want to set a minimum thread pool size</p>
  
  <p>Any help/advice would be greatly appreciated.</p>