Hello,
Actually I just thought of a much better place to check it,
add the above check to batik.gvt.UpdateTracker.changeStarted.
I think that should catch all changes that could possibly
cause trouble (which might include things like animations
and CSS which the DOM checks might not catch), and it's just
once place that you need to change...
It was a good idea to put the check there. Now i know where the application
calls Dom modifications not in the Runnable. But is it possible to do something
better then writting out ?! I'am isn't possible to transfer the action into the
Runnable ?! I mean the batik could recognize this and can do something ?!
public void changeStarted(GraphicsNodeChangeEvent gnce) {
// System.out.println("A node has changed for: " + this);
if (Thread.currentThread() !=
updateManager.getUpdateRunnableQueue().getThread()){
logger.fatal("changeStarted called not in the
UpdateManagerThread.");
printCallStack();
MOVE ACTION TO THE RUNNABLE ?!
}
I don not know the details of the batik to know what something could be ?!
The Problem is that the Runnable is a very central Thread, that must not die.
If this Thread is dead, displaying SVG's are dead, every action is dead ?!
Mit freundlichen Grüßen Michael Kerschbaum
DI (FH) Michael Kerschbaum
PKE Electronics AG
Zentrale Wien / Entwicklung
Computerstraße 6
A - 1101 Wien
TEL: +43 (0) 50 150 - 1210
[EMAIL PROTECTED]
www.pke.at <http://www.pke.at/>
Aktiengesellschaft mit dem Sitz in Wien
Firmenbuchnummer 103264i
HG Wien, DVR 0159701
Johann Helf - Vorsitzender des Vorstandes
Bruno Faustka - Mitglied des Vorstandes
Christian Prelz - Vorsitzender des Aufsichtsrates
________________________________
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 09. Oktober 2008 19:04
An: [email protected]
Cc: [email protected]
Betreff: Re: AW: Watching the UpdateManagerThread if dead of alive ?! Restart,
Stopping etc.. Watchdog ?
Hi Michael,
"Kerschbaum Michael " <[EMAIL PROTECTED]> wrote on 10/09/2008 10:25:17 AM:
> Thank you for the tipps.
>
> 1.)How can i set the document back to the canvas ?
>
> canvas.setDocument(canvas.getDocument()); ?? => what is the
> canvas in this case ? is this the JSVGComponent itself ?
Yes, it's the JSVGComponent (except most people subclass the
JSVGCanvas which is why it's called canvas).
> 2.)adding a try cache block to the Runnable Queue ?!
>
> Where exactly shoud i do this ? at the point where the
> IllegalStateException is thrown ?! Or where i call invokeLater ?!
Where the exception is thrown (around the 'runnableInvoked(rable)'
call in the run method).
> At the meantime i searched for the modification Methods and call
> them in an own class an ask if the current Thread is a
> UpdateManager's RunnableQueue Thread ?? if not i print a Stack Trace.
>
> if (Thread.currentThread() == ag.getUpdateManager().
> getUpdateRunnableQueue().getThread()) {
> parentNode.replaceChild(newElement,oldElement);
> } else {
> logger.fatal("[replaceChild] node -was not called in the
> UpdateManagers RunnableQueue.");
> printCallStack();
> }
This should work assuming you track down all of the mutation
points.
Actually I just thought of a much better place to check it,
add the above check to batik.gvt.UpdateTracker.changeStarted.
I think that should catch all changes that could possibly
cause trouble (which might include things like animations
and CSS which the DOM checks might not catch), and it's just
once place that you need to change...
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 09. Oktober 2008 12:16
> An: [email protected]
> Cc: [email protected]
> Betreff: Re: Watching the UpdateManagerThread if dead of alive ?!
> Restart, Stopping etc.. Watchdog ?
>
> Hi Michael,
>
> "Kerschbaum Michael " <[EMAIL PROTECTED]> wrote on 10/09/2008 04:31:15 AM:
>
> > The Problem is now that the application itself wont't work anymore.
> > Is there a possibility to restart or watch the RunnableQueue, and in
> > case of such an error?!
>
> The simplest way to reboot the RunnableQueue would be to
> set the document back to the canvas:
>
> canvas.setDocument(canvas.getDocument());
>
> You can know the runnnablequeue is dead by
> calling 'getThread()' on the UpdateManager's RunnableQueue
> if it returns null then it has died.
>
> > I mean i have to find the modification of the dom tree outside of
> > the updateManager, but I would like to have a fail back, and a quick
> > solution to this problem ?
>
> A slightly better short term solution would be to
> protect the RunnableQueue from runnableInvoked throwing
> an exception (adding a try cache block to the RunnableQueue).
>
> BTW to find the problem you might try instrumenting the
> DOM so that various methods check the current thread to see
> if it matches the UpdateManager's RunnableQueue Thread
> (assuming an UpdateManager is associated with the DOM).
>
> I would add the code to batik.dom.AbstractElement.setAttribute
> and setAttributeNS, as well as batik.dom.AbstractParentNode.appendChild
> That should check the most likely problems.