while (!ready) { sleep(250); } process(); ready = false;
synchronized (this) { wait(); } if (ready) { process(); ready = false; }
  public void run() {    while (true) {      checkAutoDownload();            try {        while (!ready) {          sleep(250);        }        process();        ready = false;      }      catch (InterruptedException e) {        e.printStackTrace();      }    }  }