FileDocCategorySizeDatePackage
BusyFlag.javaAPI DocExample1476Tue Jan 28 17:14:12 GMT 1997None

BusyFlag

public class BusyFlag extends Object

Fields Summary
private Thread
busyflag
private int
busycount
Constructors Summary
Methods Summary
public synchronized voidfreeBusyFlag()

          if (getBusyFlagOwner() == Thread.currentThread()) {
               busycount--;
               if (busycount == 0) {
                    busyflag = null;
                    notify();
               }
          }
     
public synchronized voidgetBusyFlag()


         
          while (tryGetBusyFlag() == false) {
               try {
                    wait();
               } catch (Exception e) {}
          }
     
public synchronized java.lang.ThreadgetBusyFlagOwner()

          return busyflag;
     
public synchronized booleantryGetBusyFlag()

          if (busyflag == null) {
               busyflag = Thread.currentThread();
               busycount = 1;
               return true;
          }
          if (busyflag == Thread.currentThread()) {
               busycount++;
               return true;
          }
          return false;