xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bishop, Michael W. CONTR J9C880" <Michael.Bis...@je.jfcom.mil>
Subject RE: Seemingly odd question...
Date Thu, 23 Mar 2006 16:51:50 GMT
Well it's a single "chat" session...this is a plugin to a chat client...I think it's the same
connection.  Wouldn't synchronizing the sensitive block of code do the trick?
 
Michael Bishop

________________________________

From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Sent: Thu 3/23/2006 11:49 AM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: RE: Seemingly odd question...



Hi Michael,

"Bishop, Michael W. CONTR J9C880" <Michael.Bishop@je.jfcom.mil> wrote on
03/23/2006 11:39:02 AM:

> So I should be using invokeAndWait(), but in that case I could run into
> deadlocking issues like I've had in the past?

   'invokeAndWait' won't help in the case of multiple threads calling the
method.  They both have the same issue that when you have multiple threads
something needs to synchronize the threads in order to ensure that
anything
happens in a particular order.

   I would actually guess that right now you may have no way to know what
the proper order of the events is on the other side of the network
connection (the order they are received may well not be the order they
are issued, if they come across separate connections) you may need to
add a sequence number to the events so you know that you have to
submit 'n+1' next and wait for it to arrive before submitting 'n+2'.

>
> Michael Bishop
>
> ________________________________
>
> From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
> Sent: Thu 3/23/2006 11:35 AM
> To: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Subject: RE: Seemingly odd question...
>
>
>
> Hi all,
>
> Andrew Plotkin <erkyrath@eblong.com> wrote on 03/23/2006 11:14:21 AM:
>
> > On Wed, 22 Mar 2006, Bishop, Michael W. CONTR J9C880 wrote:
> >
> > > Even with a call to invokeLater()?  It'd seem that invokeLater()
just
> > > kicks off a Thread and returns...
> >
> > No, it kicks the task into the queue and returns. The queue occupies a
> > single thread, which executes tasks serially.
>
>    Correct Andrew there is exactly one thread for the RunnableQueue. All
> submitted
> Runnables are executed in that thread in the order that they are added
to
> the runnable list (there is actually an interface for 'preempting' the
> queue
> but that isn't relevant here).
>
>    However, if you have multiple threads calling invokeLater the
Runnable
> Queue doesn't (and can't) enforce any order between the threads.  The
> method is thread safe (multiple threads can safely call it) but the
> critical section is actually inside the method so if you want to ensure
> that thread B submits it's runnable after thread A then thread B must
> wait until thread A returns from the call to invokeLater.
>
> > That's why they call it a queue. :)
>
>    Correct ;)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> [attachment "winmail.dat" deleted by Thomas E. DeWeese/449433/EKC]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org



Mime
View raw message