• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

To save the object data

 
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
serilization and deserialization should be done on a same version of JVM
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic