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