@@ -0,0 +1,1235 @@
+package com.atreceno.it.javanese.concurrency;%0A%0Apublic class Scheduler %7B%0A%0A%09private static final int NUM_OF_THREADS = 3;%0A%09private static final int SLEEP_MILLIS = 1000;%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09System.out.println(%22Start%22);%0A%09%09Scheduler scheduler = new Scheduler();%0A%0A%09%09SimpleThread%5B%5D threads = new SimpleThread%5BNUM_OF_THREADS%5D;%0A%09%09for (int i = 0; i %3C NUM_OF_THREADS; i++) %7B%0A%09%09%09threads%5Bi%5D = scheduler.new SimpleThread(i);%0A%09%09%7D%0A%0A%09%09int i = 0;%0A%09%09while (true) %7B%0A%0A%09%09%09System.out.println(Thread.currentThread().getName()%0A%09%09%09%09%09+ %22:  %5CtNotifying thread %22 + i);%0A%09%09%09synchronized (threads%5Bi%5D) %7B%0A%09%09%09%09threads%5Bi%5D.notify();%0A%09%09%09%7D%0A%09%09%09try %7B%0A%09%09%09%09Thread.sleep(SLEEP_MILLIS);%0A%09%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09%09e.printStackTrace();%0A%09%09%09%7D%0A%09%09%09i = ++i %25 NUM_OF_THREADS;%0A%09%09%7D%0A%0A%09%7D%0A%0A%09public class SimpleThread extends Thread %7B%0A%0A%09%09private int value;%0A%0A%09%09public SimpleThread(int value) %7B%0A%09%09%09this.value = value;%0A%09%09%09this.setName(%22tango%22 + value);%0A%09%09%09start();%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public void run() %7B%0A%09%09%09while (true) %7B%0A%09%09%09%09synchronized (this) %7B%0A%09%09%09%09%09try %7B%0A%09%09%09%09%09%09wait();%0A%09%09%09%09%09%7D catch (InterruptedException e) %7B%0A%09%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%09%7D%0A%09%09%09%09%09System.out.println(Thread.currentThread().getName() + %22:%5Ct%22%0A%09%09%09%09%09%09%09+ value + %22 %22);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%7D%0A%0A%7D%0A

Add scheduler example