X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=src%2Fnet%2Fchiark%2Fyarrg%2FMarketUploader.java;fp=src%2Fnet%2Fchiark%2Fyarrg%2FMarketUploader.java;h=4e78282de05079d205058e1ba38d35879118aaf6;hb=56a013ad992b3c8463ce43d7f73d724bb16448f5;hp=4f50228a7b77f8131902fb5e19228500322f3725;hpb=f0aff42beee7a04001ec97093704144074b35fc6;p=jarrg-ian.git diff --git a/src/net/chiark/yarrg/MarketUploader.java b/src/net/chiark/yarrg/MarketUploader.java index 4f50228..4e78282 100644 --- a/src/net/chiark/yarrg/MarketUploader.java +++ b/src/net/chiark/yarrg/MarketUploader.java @@ -254,7 +254,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { if (arb != null && arb.length() != 0) s = "" + arb + "
" + s; progmon.setNote(s); - }}.exec(); + }}.exec("progressNote"); } /* @@ -374,7 +374,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { progmon = null; } findMarket.setEnabled(true); - }}.exec(); + }}.exec("tidying"); } catch (Exception e) { System.err.println("exception tidying on UI thread:"); e.printStackTrace(); @@ -408,12 +408,22 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { private abstract class UIXR implements Runnable { public abstract ReturnType bodyr(); public ReturnType return_value; - public void run() { return_value = bodyr(); }; - public ReturnType exec() throws Exception { + private String what; + public void run() { + debuglog("UIX 2 "+what+" begin"); + return_value = bodyr(); + debuglog("UIX 3 "+what+" done"); + }; + public ReturnType exec(String what_in) throws Exception { + what = what_in; if (EventQueue.isDispatchThread()) { + debuglog("UIX 1 "+what+" (event thread) entry"); this.run(); + debuglog("UIX 4 "+what+" (event thread) exit"); } else { + debuglog("UIX 1 "+what+" (other thread) entry"); EventQueue.invokeAndWait(this); + debuglog("UIX 4 "+what+" (other thread) exit"); } return return_value; }; @@ -432,7 +442,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { resultSummary.setText("failed"); JOptionPane.showMessageDialog(frame,msg,"Error", JOptionPane.ERROR_MESSAGE); - }}.exec(); + }}.exec("error()"); } catch (Exception e) { System.err.println("exception reporting to UI thread:"); e.printStackTrace(); @@ -461,12 +471,12 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { private void setProgress(final int nv) throws Exception { new UIX() { public void body() { progmon.setProgress(nv); - }}.exec(); + }}.exec("setProgress"); } private boolean isCanceled() throws Exception { return new UIXR() { public Boolean bodyr() { return new Boolean(progmon.isCanceled()); - }}.exec().booleanValue(); + }}.exec("isCanceled").booleanValue(); } /* @@ -618,7 +628,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { debuglog("getocean done"); return at; - }}.exec(); + }}.exec("accesstable"); if (accesstable == null) return; if (latch != null) { @@ -673,7 +683,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { debuglog("table read..."); return getData(accesstable); - }}.exec(); + }}.exec("data"); if (data == null) return; if (showArbitrage) { @@ -784,7 +794,7 @@ implements Runnable, TopLevelWindowListener, GUIInitializedListener { final String summary_final = summary; new UIX() { public void body() { resultSummary.setText(summary_final); - }}.exec(); + }}.exec("resultSummary.setText"); debuglog("done."); }