private void blockUntilMovieIdSet() {
   if (mMovieId == Long.MIN_VALUE)
     synchronized (mMovieId) {
       try {
         mMovieId.wait();
       } catch (InterruptedException e) {
       }
     }
 }
Exemplo n.º 2
0
  public void run() {
    if (Log.logger != null) Log.logger.debug("Started CardReaderMonitorImpl thread");
    run = true;
    exit = false;
    boolean changed;
    boolean noReaders;
    terminals = factory.terminals();

    while (run) {
      synchronized (terms) {
        getStatusChange();
      }
      terminals = factory.terminals();
      changed = false;
      while (run && !changed) {
        noReaders = false;
        try {
          changed = terminals.waitForChange(LISTREADER_INTERVAL);
        } catch (Exception e) {
          noReaders = true;
        }
        if (run && noReaders) {
          synchronized (LISTREADER_INTERVAL) {
            try {
              LISTREADER_INTERVAL.wait(LISTREADER_INTERVAL);
            } catch (InterruptedException ie) {
              run = false;
            }
          }
        }
      }
    }
    synchronized (this) {
      exit = true;
      this.notify();
    }
    if (Log.logger != null) Log.logger.debug("Ending CardReaderMonitorImpl thread");
  }