this.data = data;
Object o; while (true) { synchronized(data) { while (data.size() == 0) { try { data.wait(); } catch (InterruptedException ie) { return; } } o = data.elementAt(0); data.removeElementAt(0); } process(o); }