What did I do wrong in the following piece of code that caused threads to never terminate?
<p>I have the following piece of code which I expected to print "DONE" at the end. But when I ran, "DONE" was never printed and the JVM in fact never terminated.</p>

<p>What did I do wrong?</p>

<pre><code>// File: Simple.java
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Simple {


    public static void main(String[] args) throws Exception{

        doTest(3);

    }

    private static void doTest(final int times) {

        ScheduledExecutorService tp = Executors.newScheduledThreadPool(times);

         Thread[] runnables = new Thread[times];
         for (int i = 0; i &lt; runnables.length; ++i) {
             runnables[i] = new Thread(new MyRunnable());
         }

         // schedule for them all to run
         for (Thread t : runnables) {
             tp.schedule(t, 1, TimeUnit.SECONDS);
         }


         try {
            tp.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
            System.out.println("DONE!");
         }catch (InterruptedException e) {
            e.printStackTrace();
        }

     }


    static class MyRunnable implements Runnable {
        @Override
        public void run() {
            System.out.println("hello world");
        }

    }

}
</code></pre>