In my program, there is a central server, and I want to store its state. I'm using serialization for this, I am serializing the data after every 2,3 seconds. So that whenever server fails, it can come back and start from that point where it left. The problem is that when server goes down, while serialization is in progress, streams are still open, so that obtained is corrupt, and is of no use. So when server goes down in that particular duration, it fails to recover. When it goes down, when serialization is not going on, it recovers and we obtain updated data.So what can I do to make it work, no matter when it goes down?I'm using java btw.
Handling server failure using serialization
java