xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Update Manager Failing
Date Thu, 03 Sep 2009 09:53:27 GMT
Hi VYang,

vyang <vyang@apt-cafm.com> wrote on 09/02/2009 10:01:26 AM:

> Now with my code below, I'm just wondering if its a good idea/good 
coding to
> put updatemanager runnables inside a swing worker.

   It's fine to have runnables in the swing thread, 
but you can't wait for them.  The problem is that occasionally 
the rendering engine needs to get information from Swing, it can
only do that safely in the Swing thread, so if the swing thread is
waiting for a runnable to complete and that runnable is waiting for
the swing thread to become available you get a deadlock.

> The swingworker is used to display an progress bar only (I believe). 
> I've read somewhere that the progress bar should be run under 
> swingutilities runnable.

    Right updates to swing components must be done in the Swing thread.
I would suggest that you submit a runnable to the swing thread to update
the progressbar when your runnable in the UpdateManager thread completed.

> vyang wrote:
> > 
> > SwingWorker worker = new SwingWorker(){
> >                 public Object construct() {
> >                     try {
> > 
> > finalDrawingPanel.getUpdateManager().getUpdateRunnableQueue().
> invokeAndWait(new
> > Runnable(){

   Here is the problem you can't wait on UpdateManager runnables
from the Swing Thread.

View raw message