try { while (true) { LinkedList ll = new LinkedList(); synchronized (pendingRecords) { try { pendingRecords.wait(); if (!isAlive()) return; } catch (InterruptedException ex) { if (!isAlive()) return; else continue; } Iterator ti = pendingRecords.iterator(); while (ti.hasNext()) { PendingRecord next = (PendingRecord) ti.next(); if (next.hasPending()) { ll.add(next); ti.remove(); } else if (next.isTerminated()) {  ti.remove(); } } } Iterator it = ll.iterator(); while (it.hasNext()) { PendingRecord next = (PendingRecord) it.next(); next.processPending(); } } } finally { if (LogWriter.needsLogging) logWriter.logMessage("exitting pendingRecordScanner!!"); } }
try { PendingRecord pr = null;  while (true) { synchronized (pendingRecords) { try { if (pendingRecords.size() == 0) pendingRecords.wait();  if (!isAlive()) { return; } else if (pendingRecords.size() != 0 ) { pr = (PendingRecord) pendingRecords.get(0); pendingRecords.remove(0); } else continue; } catch (InterruptedException ex) { if (!isAlive()) return; else continue; }  } if (!pr.isTerminated()) pr.processPending(); } } finally { if (LogWriter.needsLogging) logWriter.logMessage("exitting pendingRecordScanner!!"); }  }
		public void run() {			try {				while (true) {					LinkedList ll = new LinkedList();					synchronized (pendingRecords) {						try {							pendingRecords.wait();							if (!isAlive())								return;						} catch (InterruptedException ex) {							if (!isAlive())								return;							else								continue;						}						Iterator ti = pendingRecords.iterator();						while (ti.hasNext()) {							PendingRecord next = (PendingRecord) ti.next();							if (next.hasPending()) {								ll.add(next);								ti.remove();							} else if (next.isTerminated()) {								// Clean up if the the transaction is terminated.								ti.remove();							}						}					}					Iterator it = ll.iterator();					while (it.hasNext()) {						PendingRecord next = (PendingRecord) it.next();						next.processPending();					}				}			} finally {				if (LogWriter.needsLogging)					logWriter.logMessage("exitting pendingRecordScanner!!");			}		}