“Premature end of file” error when Java read and writes XML data files

前端 未结 4 2055
余生分开走
余生分开走 2020-12-17 00:36

I have been using JDOM library to read and write XML files through Java Servlets.

Problem is that when I send many requests using AJAX to my servlets which read and

4条回答
  •  温柔的废话
    2020-12-17 00:56

    Two possible solutions are:

    • Write your files to thename.xml.part and then once done/closed to a rename to thename.xml, which makes the write closer to being atomic -- the reader can't read it until it's surely done so long as it is looking for ".xml" files only.
    • or, use a Database, atomicity is what they do.

提交回复
热议问题