import java.util.*; public class DataTC { public static LinkedList TC; public DataTC() { TC=new LinkedList(); } public synchronized void Produce(Object o) { TC.add(o); notifyAll(); } public synchronized Object Consume() { try { if(TC.isEmpty()) { wait(); // System.out.println("TC waiting"); } return TC.removeFirst();// else return the head of the que } catch(Exception e) { System.out.println("Error DataTC "+e); return null; } } public synchronized void awake() { System.out.println("null produced"); Produce(null); } }