Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

file as temporary data storage  RSS feed

 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

If my application can not establish connection with the server it is storing 8000 records in files.After connection with the server resumes it sends those records to server one by one and simultaneously deletes those records from the file.
So if i use ObjectSerialization then I will not be able to delete a record from the file. Should I go with XML(can I delete a record from a xml?) or is there any other suggestion?
With regards, Ajse
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So if i use ObjectSerialization then I will not be able to delete a record from the file.

Why not? If you serialize the records as an instance of ArrayList you can read the entire list in, delete the individuals as you get confirmation that they have been received, and write out the modified ArrayList if the server connection fails.
You can also do this with XML, keeping a DOM of the entire collection of records in memory, deleting Elements as they are sent, and writing out the DOM as needed.
Object serialization will probably be faster and use less memory, but XML serialization has the advantage of being human readable.
Bill
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!