开发者

Asynchronous parsing in Java

I just want to implement a parser to parse my xml. I need clarification from you guys before I start it. Can you guys please suggest a best method or mechanism to parse 开发者_运维技巧my xml and rendering it asynchronously.


Do it in separate thread. You can 1. open thread yourself 2. use threadpool 3. use Timer.schdule()


Don't reinvent the wheel - JDOM does a fantastic job with XML.

As for doing so asynchronously, I would have the parsing thread parse and build whatever data you need, then make it publicly accessible by assigning it to a volatile variable once it's done. You could also use the callback pattern. Parsing your XML is a separate problem from doing so asynchronously; any asynchronous processing pattern will work just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜