HTMLEditorKit - thread safety
Jeg bruger HTMLEditorKit til at identificere en række links på en HTML-side. Hvert af disse links åbnes og indholdet parses.Ofte er jeg ude for, at programmet så at sige "kløjs" i åbningen af nye links, og jeg gætter på (?), at det har noget med thread safety at gøre.
Hvordan sikrer man, at dette ikke sker?
_____________________
Baggrund:
arne_v har tidligere henvist mig til flg. link:
http://www.informit.com/articles/article.asp?p=31059&seqNum=5
- hvor det fremgår:
The biggest downside to this HTML parser is that it is not thread safe (thread safety has always been a problem with Swing components). This HTML processor is no different. I have used the Swing parser in heavily threaded environments, and it has resulted in a crash—eventually. If you want to use this HTML processor in a heavily threaded environment, you need to take steps to ensure that only one thread uses it at a time.
Min kode er skematisk noget i retning af koden på: http://spectral.mscs.mu.edu/Ent2002/tools/HTMLParser.html
