Hi Sudhakar,

Sudhakar S <[EMAIL PROTECTED]> wrote on 08/18/2006 12:16:17 AM:

> Using "invokeLater", it is working fine without any problem.
> But it is happening in separate thread, I couldn't synchronize with main
> thread. 

   Well you can synch it in this case but it would be more work.

> So changed "invokeLater" to "invokeAndWait". But after changed to
> "invokeAndWait", it is not at all drawing the shapes. It simply hangs. 
So I
> couldn?t find any solution to resolve this.

   It is very dangerous to call invokeAndWait from Swing thread (which is
what you are doing).  In some cases the renderer needs to query the 
Canvas which can only be done in the Swing thread.  It can't run code in
the Swing thread because you have it blocked waiting for the update
to complete.

   The general solution to this problem is to introduce a third thread
that can safely call invokeAndWait and then run some code in the
Swing thread.

   I should say that it is a really bad idea to lockup the Swing thread
for long periods anyway so this should improve your applications behavior
as the UI won't "Freeze" from extended periods any more.

> While go through the nabble threads related to ?invokeAndWait?, it told
> "updatecompleted" must be completed before calling ?invokeAndWait?. So 
can
> you please tell how to find whether updatecompleted is completed or not? 


   I don't think this is your problem:

> I have attached thread dump along with this mail.

> "RunnableQueue-0" daemon prio=7 tid=0x02cbcd30 nid=0xb78 in 
Object.wait()
> [0x036ef000..0x036efc68]
>         at java.lang.Object.wait(Native Method)
>         - waiting on <0x1d7dc310> (a 
java.awt.EventQueue$1AWTInvocationLock)
>         at java.lang.Object.wait(Unknown Source)
>         at java.awt.EventQueue.invokeAndWait(Unknown Source)
>         - locked <0x1d7dc310> (a java.awt.EventQueue$1AWTInvocationLock)
[....]
>         at 
org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:203)
>         at java.lang.Thread.run(Unknown Source)
> 

> "AWT-EventQueue-0" prio=7 tid=0x02cfec30 nid=0xc78 in Object.wait()
> [0x0376f000..0x0376fb68]
[...]
>         at 
org.apache.batik.util.RunnableQueue.invokeAndWait(RunnableQueue.java:271)
[...]
>         at java.awt.EventQueue.dispatchEvent(Unknown Source)
>         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> Source)
>         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
> Source)
>         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>         at java.awt.EventDispatchThread.run(Unknown Source)


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

Reply via email to