aspose file tools*
The moose likes Java in General and the fly likes To save the object data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "To save the object data" Watch "To save the object data" New topic
Author

To save the object data

James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

My application that i am working on does not have a database it does all the works by using the services available. Now we came across a problem. One of the service that we use could fail sometimes(even after retrying) which leads to loss of data that we are supposed to send to that service.

One solution that i know is to use serialization and resend data at later point in time. The problem is, what if the machine at which our application running fails(goes down). The serialized object would be lost.

Can anyone suggest an alternative to save the data.Alternative to save the data or alternative to save the serialized object


SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
you could serialize to files. If your machine goes down objects can be created using those
serialized objects in the files when it's running back up again.

One caveat but, if you deploy a different version of the classes and try to deserialize
objects from a different version you may run in to trouble.

Also how about saving the information to flat files, or xml?
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

serilization and deserialization should be done on a same version of JVM


SCJP6.0,My blog Ranchers from Delhi
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

I am much worried about the situation wherein the machine in which the app is deployed crashes. In that case the serialized objects will also be lost.
(Please keep in mind that i dont have the a DB to store the data)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

If you have no way to persistently store objects (you don't have a database as you say, or you don't have a file system where you can store the serialized objects in a file), then there is no way you can save the data if the application crashes.

Serialization is not some magic way of storing your objects in case you don't have a place to store them persistently; it's just a mechanism to convert objects to and from a format that's suitable for storing them somewhere.

To solve this problem, you need some kind of persistent store, whether it's a database, a file system or something else.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

Jesper Young wrote:To solve this problem, you need some kind of persistent store, whether it's a database, a file system or something else.

Thanks for this strong statement that would never make me think of another alternative which having a way to store (DB or file system)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To save the object data