if (getBusyFlagOwner() == Thread.currentThread()) { super.freeBusyFlag(); if (getBusyFlagOwner() == null) { Thread.currentThread().setPriority(currentPriority); notifyAll(); } }
while (tryGetBusyFlag() == false) { Thread prevOwner = getBusyFlagOwner(); try { int curP = Thread.currentThread().getPriority(); if (curP > prevOwner.getPriority()) { prevOwner.setPriority(curP); } wait(); } catch (Exception e) {} }
boolean succeed = super.tryGetBusyFlag(); if (succeed) currentPriority = Thread.currentThread().getPriority(); return succeed;