}
private void spinOffCompletedLoader(final AuctionServer newServer) {
Thread completedHandler = new Thread() {
public void run() {
final MessageQueue tabQ = MQFactory.getConcrete("complete Tab");
tabQ.enqueue("REPORT Importing completed listings");
tabQ.enqueue("SHOW");
timeStart("findEnded");
List<AuctionEntry> entries = AuctionEntry.findEnded();//TODO EntryCorral these?
timeStop("findEnded");
int endedCount = entries.size();
final double percentStep = ((double)endedCount) / 100.0;
final double percentMultiple = 100.0 / ((double)endedCount);
tabQ.enqueue("PROGRESS");
tabQ.enqueue("PROGRESS Loading...");
importListingsToUI(newServer, entries, new Report() {
public void report(AuctionEntry ae, int count) {
if(percentStep < 1.0) {
tabQ.enqueue("PROGRESS " + Math.round(count * percentMultiple));
} else {
if(count % (Math.round(percentStep)) == 0) {
tabQ.enqueue("PROGRESS " + Math.round(count / percentStep));
}
}
try { Thread.sleep(50); } catch(InterruptedException ie) { /* ignore */ }
}
});
tabQ.enqueue("HIDE");
AuctionEntry.getRealDatabase().commit();
}
};
Thread lostHandler = new Thread() {
public void run() {