Hi Michael,

"Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on 
08/23/2007 04:08:25 PM:

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

   All Runnables added to the runnable queue are run in a single
thread in the order that they are added.

> However, they could FINISH at different times.

   The run methods of your Runnable will finish in the order 
they were submitted and previous runnables run method must finish 
before the next run method starts.

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

    If this really happened it would indicate a serious bug in the code.
A Runnnable could start a separate thread (or run something in another
suitable thread like swing) and unless the RunnableQueue runnable waited
for the other thread to complete you could get behavior that looked a
lot like this.

> 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:[EMAIL PROTECTED] 
> Sent: Thursday, August 23, 2007 3:48 PM
> To: [email protected]
> 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: [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