while (true)
synchronized (getTreeLock ())
  public boolean isAncestorOf(Component comp)  {    while (true)      {        if (comp == null)          return false;        if (comp == this)          return true;        comp = comp.getParent();      }  }