waiters = new Vector();
if (Thread.currentThread() != busyflag) throw new IllegalArgumentException("QueuedBusyflag not held"); if (busycount == 0) { waiters.removeElementAt(0); notifyAll(); busyflag = null; } else busycount--;
Thread me = Thread.currentThread(); if (me == busyflag) { busycount++; return; } waiters.addElement(me); while ((Thread) waiters.elementAt(0) != me) { try { wait(); } catch (Exception e) {} } busyflag = me; busycount = 0;
if (waiters.size() != 0 && busyflag != Thread.currentThread()) return false; getBusyFlag(); return true;