Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3868

Re: Worker Threads and ED

From "tar" <tar@THRWHITE.remove-dii-this>
Subject Re: Worker Threads and ED
Message-ID <ymi7ib0cur3.fsf@blackcat.isi.edu> (permalink)
Newsgroups comp.lang.java.gui
References <aVJkk.50144$nD.30868@pd7urf1no>
Date 2011-04-27 15:47 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
i.dont.need@any.more.email writes:

> I have some legacy code to spruce up, and it breaks one of the
> cardinal rules of swing: it updates the UI with worker threads (not
> the EDT). Finding all of the potential culprits is easy, but there are
> hundreds of cases which could be problematic, and the vast majority
> are fine. It is quite difficult to determine via inspection whether or
> not a specific worker thread will cause problems ... How can I figure
> out which threads have a transitive dependency back to some UI object?

Well, what sorts of actions does the application take in connection with
the EDT?

If you know what types of manipulation are being done, then you may be
able to instrument just the places where those sorts of things happen,
such as creating new windows, updating the state of controls, etc.

You could insert something like:

  assert SwingUtilities.isEventDispatchThread();

in the places where UI elements are created, modified or manipulated and
see where any errors pop up.  You would need to make sure you enabled
assertion checking for the development phase.


> Is there any way I could instrument the code
> so that in development, I could throw an exception any time a component
> is touched by a thread other than the EDT?

I was working on one project where they had some such instrumentation,
which threw an exception if it thought something was doing GUI work on a
thread other than the EDT.  But I don't recall what was done to achieve
this.  But there is something out there.


-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Worker Threads and EDT "i.dont.need" <i.dont.need@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
  Re: Worker Threads and ED "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
    Re: Worker Threads and ED "i.dont.need" <i.dont.need@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
    Re: Worker Threads and ED "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
      Re: Worker Threads and ED "jlp" <jlp@THRWHITE.remove-dii-this> - 2011-04-27 15:48 +0000
  Re: Worker Threads and ED "Larry A Barowski" <larry.a.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
    Re: Worker Threads and ED "i.dont.need" <i.dont.need@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000
      Re: Worker Threads and ED "Larry A Barowski" <larry.a.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:47 +0000

csiph-web