FileDocCategorySizeDatePackage
PriorityBusyFlag.javaAPI DocExample2175Thu Feb 04 16:10:40 GMT 1999None

PriorityBusyFlag

public class PriorityBusyFlag extends BusyFlag

Fields Summary
protected int
currentPriority
Constructors Summary
Methods Summary
public synchronized voidfreeBusyFlag()

		if (getBusyFlagOwner() == Thread.currentThread()) {
			super.freeBusyFlag();
			if (getBusyFlagOwner() == null) {
				Thread.currentThread().setPriority(currentPriority);
				notifyAll();
			}
		}
	
public synchronized voidgetBusyFlag()

		while (tryGetBusyFlag() == false) {
			Thread prevOwner = getBusyFlagOwner();
			try {
				int curP = Thread.currentThread().getPriority();
				if (curP > prevOwner.getPriority()) {
					prevOwner.setPriority(curP);
				}
				wait();
			} catch (Exception e) {}
		}
	
public synchronized booleantryGetBusyFlag()

		boolean succeed = super.tryGetBusyFlag();
		if (succeed)
			currentPriority = Thread.currentThread().getPriority();
		return succeed;