FileDocCategorySizeDatePackage
BusyFlag.javaAPI DocExample1475Tue Jan 28 17:13:42 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;
          }
     
public voidgetBusyFlag()


        
          while (tryGetBusyFlag() == false) {
               try {
                    Thread.sleep(100);
               } 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;