Hi! I am using the following code to open XML files:
Now, after surfing on the webpages for a while(generated with jsp, content source is XML) Tomcat reported that too many documents are opened. I had to restart Tomcat. So do I have to explicitly close the xml-files? How? Thanks for your help, Robert.
Don't be lazy, construct a FileReader first, after build, close it. This will solve too many files open problem. This is extremely important to busy websites. The resources will be used really quickly. You don't DOS (deny of services) by your own mistake. You original code will never close the valuable resources. All 60 files are closed after build, but all Documents are still available for traversal. See complete tested code here: http://bobcat.webappcabaret.net/javachina/faq/xml_java_01.htm#jaxp_jdom_Q30 [ April 12, 2003: Message edited by: Roseanne Zhang ]
subject: How do I close an opened XML-file I just read?