Hi,

Batik has continued to be excellent to work with. Thanks to Thomas for
helping out with the last issue that I raised.

I am using Batik in an applet and I am seeing some strange behaviour when
the applet is stopping. I am using a version of CVS that I got today and
Java 1.4.2. I have also seen this behaviour with Batik 1.5 and Java 1.4.1.

When the Threads in the applet's ThreadGroup are being stopped, the
CleanerThread catches a ThreadDeath Error. Since this stops the propagation
of the ThreadDeath Error, the CleanerThread is never stopped. The doc for
ThreadDeath
(http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadDeath.html) states
that the ThreadDeath Error should only be caught if some cleanup must be
done if it is stop asynchronously. I don't think that this is the case with
the CleanerThread.

Since I haven't seen any discussion about this on the mailing list before, I
am guessing that some peculiarity of my code is stopping the CleanerThread
from being stopped when it should, necessitating the ThreadDeath when the
applet is stopping.

Anyway, as a workaround in my code I changed the run method in
CleanerThread.java from:

public void run() {
        while(true) {
                try {
                        ...               
            } catch (Throwable t) {
                t.printStackTrace();
            }
       }
}

into:

public void run() {
        while(true) {
                try {
                        ...               
            } catch (Exception e) {
                e.printStackTrace();
            }
       }
}

This allows the ThreadDeath Error to propagate and the CleanerThread to be
forcibly shut down.

If anyone has seen a similar problem and managed to work out what it was in
their code that was causing the CleanerThread to hang around until the
applet was closed I would really appreciate hearing about it - I am not so
keen on changing the Batik code.

-Daniel Spasojevic


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to