title: How can I create a new thread only if no other threads are currently open?
body: <p>This code creates and starts a thread:</p>
  
  <pre><code>new Thread() {
      @Override
      public void run() {
          try { player.play(); }
          catch ( Exception e ) { System.out.println(e); }
      }
  }.start();
  </code></pre>
  
  <p>I'd like to modify this code so that the thread only starts if there are no other threads open at the time! If there are I'd like to close them, and start this one.</p>