Set queue = TxQueueFinder.findByStatus("wait");
queue = TxQueueFinder.findByStatus("wait");
  public void run( ) {    while (true) {      if (this.gd.isStopped()) {        break;       }      Set queue = TxQueueFinder.findByStatus("wait");      if (queue.size() > 0) {        DL.itemsInQueue(queue);         Iterator iter = queue.iterator();        while (iter.hasNext()) {          TxQueue tx = (TxQueue) iter.next();          if (tx.apply(this.gd)) {            DL.appliedTx(tx);          }           else {            DL.failedToApplyTx(tx);            if (!tx.setFailed(this.gd)) {              DL.failedToSetFailed(tx);            }          }        }      } /*          TxQueue tx  = (TxQueue) iter.next();          if (tx.getClass() == TxStop.class) {            try {              HibernateHelper.delete(tx);              DL.deleteTx(tx);              this.gd.stopDaemon();            }            catch (HibernateException eH) {              String  msg = eH.getMessage();              DL.failToDeleteTx(tx, msg);              break;            }          }*/      try {        Thread.sleep( (long) (Math.random() * 1000) );      } catch (InterruptedException e) {        // Nothing      }    }  } // public void run()