X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=src%2Fcom%2Ftedpearson%2Fypp%2Fmarket%2FMarketUploader.java;h=bac55220cf9658d6538a907bc754f30214a5d6c2;hb=ab0647726ea33606a5864f7f17e13c8e6fbb33b0;hp=b3fa49fdb99ed99dc0eb60974d88bc4f18fd380d;hpb=985508c692b6de7964d89ede3b6cf3da1b5b55c7;p=jarrg-ian.git diff --git a/src/com/tedpearson/ypp/market/MarketUploader.java b/src/com/tedpearson/ypp/market/MarketUploader.java index b3fa49f..bac5522 100644 --- a/src/com/tedpearson/ypp/market/MarketUploader.java +++ b/src/com/tedpearson/ypp/market/MarketUploader.java @@ -409,19 +409,31 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis * * @exception Exception if an error we didn't expect occured */ + private class YarrgTimestampFetcher extends Thread { + public String ts = null; + public void run() { + try { + ts = getYarrgTimestamp(); + progresslog("(async) yarrg timestamp ready."); + } catch(Exception e) { + error("Error getting YARRG timestamp: "+e); + } + } + }; + private void runUpload() throws Exception { progresslog("starting"); - String yarrgts = ""; ProgressMonitor pm = new ProgressMonitor(frame,"Processing Market Data","Getting table data",0,100); pm.setMillisToDecideToPopup(0); pm.setMillisToPopup(0); boolean doneyarrg = false, donepctb = false; + YarrgTimestampFetcher yarrgts_thread = null; if (uploadToYarrg) { - progresslog("yarrg timestamp..."); - yarrgts = getYarrgTimestamp(); - progresslog("yarrg timestamp done."); + progresslog("(async) yarrg timestamp..."); + yarrgts_thread = new YarrgTimestampFetcher(); + yarrgts_thread.start(); } AccessibleTable accesstable = findMarketTable(); @@ -449,6 +461,14 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis } progresslog("(async) getisland done"); + String yarrgts = null; + if (yarrgts_thread != null) { + progresslog("(async) yarrg timestamp join..."); + yarrgts_thread.join(); + progresslog("(async) yarrg timestamp joined."); + yarrgts = yarrgts_thread.ts; + } + if (islandName == null) { error("Could not find island name in YPP user interface."); return;