xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Archie Cobbs" <arc...@awarix.com>
Subject Re: invokelater thread issue?
Date Thu, 23 Aug 2007 21:22:32 GMT
This all doesn't make sense based on my understanding and experience, which
is that there is only one updater thread per JSVGComponent, and it processes
all actions registered with invokeLater() in the same order they are
registered.

FYI the relevant code is in org/apache/batik/util/RunnableQueue.java.

If someone can construct a counter-example (e.g., build an SVG document
programattically then print it out) that would be interesting to see...

On 8/23/07, Bishop, Michael W. CONTR J9C880 <Michael.Bishop@je.jfcom.mil>
wrote:
>
> I ran into a similar problem.  I could be wrong, so someone correct me,
> but I believe all the threads are STARTED in the order they are put in
> the RunnableQueue.  However, they could FINISH at different times.  If
> Thread A takes 10 seconds to run and Thread B takes 5 seconds, Thread B
> will finish before Thread A and could possibly cause the issues you're
> running into.
>
> My (not-so-elegant) solution was to modify the run() methods of my
> Threads to synchronize on the same object:
>
> public void run() {
>    synchronized(someCommonObject) {
>       ...
>    }
> }
>
> Michael Bishop
>
> -----Original Message-----
> From: vyang [mailto:vyang@apt-cafm.com]
> Sent: Thursday, August 23, 2007 3:48 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: invokelater thread issue?
>
>
> Hello,
>
> It seems I'm having some issue with invokelater threading.  I have a
> method that does multiple invokelater calls.  It seems to work fine when
> this method is called once, however when inside a loop it seems the
> invokelater are called out of order.  This results in the text element
> being null when the tspan tries to grab it.  My coding is as follows:
>
> private void placeCellText() {
> final TextBoxElement textBoxElement = new
> TextBoxElement(textBoxElementID, elementName,
>                 x, y, layer, null, textBoxAttribute);
>
> textBoxElement.addNew(drawingPanel, parent.getConnection());  >> this
> method calls invokelater which creates the text element
>
> Vector textContentClone = (Vector)temp.clone();
>
> while (textContentClone.size() > 0) {
>      TextBoxElementContent firstTextBoxElementContent =
> (TextBoxElementContent)textContentClone.remove(0);
>      addTexts(textBoxElement, firstTextBoxElementContent); >> this
> method calls invokelater which adds tspan element to text element above
>
>      for (int i = 0; i < textContentClone.size(); i++) {
>
>           if (firstTextBoxElementContent.getRow() ==
> secondTextBoxElementContent.getRow()) {
>           addTexts(textBoxElement, firstTextBoxElementContent); >> this
> method calls invokelater which adds tspan element to text element above
>           }
>      }
> }
>
> Is there a way to make sure the first invokelater is done executing
> before the next one begins.  Also is this a good way to use invokelater
> threading?
>
> vyang
> --
> View this message in context:
> http://www.nabble.com/invokelater-thread-issue--tf4319567.html#a12300668
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
Archie L. Cobbs
CTO, Awarix, Inc.
http://www.awarix.com

Mime
View raw message