Client-server application written in Java. Some actions (chains of methods) are performed on the server, then the server crashes. Are there any means to continue the interrupted actions after the server restart? That is, to restore the data before the server crashes, and the work of the following methods continues.
- Yes, there are files. - iksuy
- I meant the automatic continuation of the execution, the files themselves will not understand what to do - Denis Maslakov
- 2@iksuy has already spoken, I will add - log what you are doing to the files, you can continue with this information, for example, databases work with transactions. - Artem Konovalov
1 answer
Information about where and in what condition the program was interrupted cannot hang in a vacuum. If the server (hardware or server application) crashes, the program stops running and is unloaded from memory. To restore the previous state, you need to take it from somewhere. To do this, you need to write the necessary information, for example on a disk, in files. Usually, it is carefully analyzed what minimum data set is needed to restore program execution from the crash site (or from a location close to the crash site) and this data set is written to disk at certain intervals. When the program starts, it is loaded from disk and, depending on the loaded data, the program continues execution. Since for each program the set of such data will be completely different, as well as the way it is saved to disk and read from the disk in the future, even if there are automatic tools (I have not heard of such, but who can tell), I think that the configuration will not be too simple, and it is often easier to invent your bike for a specific case.