title: Run all scheduled tasks by ScheduledExecutorService at a lower priority than rest all other threads in application
body: <p>I need to run all scheduled tasks/ threads executed by <code>ScheduledExecutorService</code> at a lower priority(at <code>MIN_PRIORITY</code>) than rest all other threads in the application.  I have been doing this the following way, but is this the correct way to accomplish this ?</p>
  
  <pre><code>ScheduledExecutorService schdExctr = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
  
      @Override
      public Thread newThread(Runnable r) {
          Thread t = new Thread(r);
          t.setPriority(Thread.MIN_PRIORITY);
          return t;
      }
  });
  </code></pre>
  
  <h2>EDIT:</h2>
  
  <p>I think a better implementation would be this:</p>
  
  <pre><code>private ScheduledExecutorService schdExctr = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
                                              @Override
                                              public Thread newThread(Runnable r) {
                                                  Thread t = Executors.defaultThreadFactory().newThread(r);
                                                  t.setPriority(Thread.MIN_PRIORITY);
                                                  return t;
                                              }
                                          });
  </code></pre>