Mike Favata wrote:

Thank you for your help. I am still working on the problem. Perhaps it is my lack of experience in threading. What kind of setup do you recommend?

Well I don't really know what you are doing so it's hard for me to give advice.

For example, I currently have the JSVGCanvas instantiated from the swing thread. I have another thread I am using to listen to the UpdateManager events, and another thread I am using to have UpdateManager process DOM changes. Do you recommend something more simple or robust?

Well I guess I don't really understand the need to have a thread listen to events. Events are handled as callbacks so your listener will be called in what ever thread the event dispatcher uses. Most people do not need a thread to initiate UpdateManager DOM changes - however since you seem to need to use invokeAndWait this is probably needed.

   What really isn't clear to me is why you need to use
two seperate runnables (why the code for both can't be
put in one runnable) and/or why you need to run other code
in the 'middle' of the two runnables and can't do that in
the UpdateManager thread (or via an invokeAndWait on the
Swing thread).

Also, is the UpdateManager running on the same thread as the JSVGCanvas?

No the UpdateManager does not run in the Swing Event thread.


In my test code (running from the swing thread) I am waiting for the UpdateManager to fire the updateCompleted event.

If you register event listeners with the JSVGCanvas it calls you back from the Swing thread (as it is a swing component). Unless you release the swing thread it can't do this.

If the UpdateManager is on the same thread then I will be waiting
indefinitely correct?

You will be waiting indefinitely but because the swing thread is used to deliver the events not because the actual processing takes place in the Swing thread.

Thank you for your patience. I hope I am close to solving this problem!

Thanks!

-Mike

-----Original Message-----
From: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 7:23 PM
To: Batik Users
Subject: Re: invokeAndWait hang problem


Hi Mike,


    I really don't have any solid ideas to help, but I
have a few comments that might help sort this out.

1) There is essentially _no_way_ just the fact that you have
    references in the runnables causes the deadlock.  The
    problem must be in the code that was using those references
    (that had to be removed when then reference was removed).

2) As far as synchronization, invokeLater still guarantees
    order.  So if you call invokeLater twice the second
    invokeLater runnable will not start until the first one
    completes.

3) Have you looked at where the threads are deadlocking?
    On windows this can be done from a DOS window by pressing
    ctrl-break.  In UNIX I think it is a 'kill -3'.  The JVM
    will dump the stack trace for all threads so you can see
    where the UpdateManger thread is hung up.

    My first suspicion is that the first runnable is never
returning for some reason...

    As far as knowing when a runnable completes the easiest
thing to do is have it call a method when it is about to end.
You can also use wait and notify to 'wake up' another thread.

    There is currently no general event dispatch for runnable
completion.

Mike Favata wrote:


Thomas,

I did more experimenting and the problem stems from my runner classes having references to either the SVG document or an element of the SVG document. If you take the references out, both runners will execute with the invokeAndWait method. How
am I supposed to update the DOM within UpdateManager if I cannot reference parts of the DOM from within my runner classes? Also, why does the first runner succeed and the second hang? Any help would be greatly appreciated. Thanks!


-Mike

-----Original Message-----
From: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 18, 2004 5:56 PM
To: Batik Users
Subject: Re: invokeAndWait hang problem


Mike Favata wrote:



Hello all,

I am having trouble with the invokeAndWait method offered by UpdateManager. I am able to call invokeAndWait successfully in this block of code:


Hi Mike,

   I suspect that you are calling invokeAndWait from the
Swing event thread.  This is prone to causing deadlocks
as you have discovered.  You need to move the calls to
invokeAndWait to another thread.



---------------------------------------------------------------------
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]





---------------------------------------------------------------------
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]




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



Reply via email to