Hi Andreas,

> Thanks for your reply! I've been finally able to fix the problem. However I 
> don't think that the patch provided on Bugzilla works.
> Therefore here my changes on the CleanerThread class for anyone interested:

Overall, it looks good. Could you turn it into a patch and attach to
the relevant bug, please? (And add a link to that message/thread [1]
as well). Thanks! (If you are unable to/not interested in
contributing, at least confirm it so one can try to pick up from
here.) :-)


> I capitalised the constants:
[...]
> And introduced a control variable for the thread:
[...]
> A static access method for the singleton implementation of the CleanerThread. 
> Please note that the user Archie Cobbs is right with his estimation, that the 
> existing method isn't thread safe (although the suggested double check lock 
> won't work). I got several instances of CleanerThreads with the existing code:
> And one for the ReferenceQueue (which isn't actually a singleton):
[...]
> The CleanerThread-constructor should at least throw an exception if one tries 
> to create more than one instance:
[...]
> The run method evaluates the control variable, which is only possible if we 
> use the timeout facility of the remove method:
[...]
> And finally the exit method, which can be called to stop the CleanerThread:
[...]
> I identified furthermore the UpdateManager as a source of these 
> RunnableQueue-nn and Timer-nn threads. A call to interrupt stops these 
> threads, maybe its somewhere documented, but I couldn't find it:
[...]

The reasoning is very coherent and sounds fine - I'd even invite you
to consider becoming an active contributor through being more active
in the mailing list and/or even pick up on a few open issues [2]...
;-)

@Other developers: what do you think about this? Overall, to me they
look good but I'm not enough into the details to properly estimate the
impact introduced by the these changes.


> Remains the question why Batik needs all this thread-stuff? Unfortunately I 
> don't have the time to figure this out.

I guess this is already answered in the previously provided link: it
has to do with thread safety [3]. ;-)


> The solution above works fine for me.

Glad to hear you find your way! :-)


> Cheers,
>        Andreas

Thanks for sharing,
 Helder


[1] 
http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/201011.mbox/browser#msg-1
[2] 
https://issues.apache.org/bugzilla/buglist.cgi?query_format=specific&bug_status=__open__&product=Batik
[3] http://xmlgraphics.apache.org/batik/using/scripting/java.html#Threads

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to