Hello,
     I don't think I'm calling it from the Swing thread.  This code is
basically called from an ActionListener.  Are ActionListeners executed
in the Swing thread?  I'm not explicitly calling
SwingUtilities.invokeAndWait() or anything like that.

The ActionListener calls a static method in a utility class:

    public static boolean runInUpdateManager(Runnable runnable) {
        boolean returnValue = false;
        try {
            if (GVTListener.getTreeRendered()) {
                returnValue = true;
                BatikDemo2.getSVGCanvas().getUpdateManager()
 
.getUpdateRunnableQueue().invokeAndWait(runnable);
            }
        } catch (InterruptedException iE) {
            iE.printStackTrace();
        }
        return returnValue;
    }

So yes, I'm calling invokeAndWait() in the RunnableQueue, but I didn't
think I was deadlocking with Swing.  I guess if ActionListeners are run
in the Swing thread, this could be the problem.

Michael Bishop

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Saturday, October 22, 2005 11:25 AM
To: [email protected]
Cc: [email protected]
Subject: Re: Resize bug?

"Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on

10/21/2005 09:18:18 AM:

> I know, I?m running the whole list today!  I have another issue.  I?m 
trying 
> to resize the document by setting width and height attributes:
> 
> public void setSize(String width, String height) {
>     svgDocument.getDocumentElement().setAttribute(SVGConstants.
> SVG_WIDTH_ATTRIBUTE, width);
>     svgDocument.getDocumentElement().setAttribute(SVGConstants.
> SVG_HEIGHT_ATTRIBUTE, height);
> }
> 
> I execute the above code in the run() method of a Runnable class which
I 
then 
> execute in the UpdateManager.  More often than not, it causes the
entire 

> application to hang. 

  I would guess that you are calling invokeAndWait on the RunnableQueue?
And you are doing this from the Swing thread?  If so this is a known 
issue,
basically in some cases Batik needs to get info from Swing in which case

it
needs to call into the Swing Thread if you are sitting in it then it 
causes
a deadlock.  In this case you will need to either switch to invokeLater,

or
move your call to invokeAndWait out of the Swing thread (into a third 
party
thread you control).

> No button response.  No CPU spike.  No error message. 
> Just locks up.  With System.out, I?ve determined that the code never 
exits 
> from the above setSize() method.  Does anyone have any tips on why
this 
would 
> happen?  Is there some kind of deadlock with running a Runnable in the

> UpdateManager?  All my other operations; add element, remove element, 
set the 
> background element, etc. run without issue.

  You can get a thread dump in windows by running the 
application from the command line and pressing ctrl-break in
the DOS Window, from Unix you can use 'kill -QUIT <java processes id>'.
This should make it clear what the problem is.


> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to