We’re going to be building an application that manages multiple types of queues. I’m looking into the best ways to not lose data if the application crashes for any reason. I’ve done some googling using the term “persisting” which leads me to JPA over and over. I have some experience with JPA. I’m no expert on the “shutdown sequence” of Java in the event of a crash and am wondering what’s involved with persisting a queue. Are there libraries that provide some of this functionality?
We’re going to be building an application that manages multiple types of queues. I’m
Share
There is no consistent “shutdown sequence” during a crash, that’s why it’s called a crash. Someone can pull the plug out of a wall socket or accidentally drive a monster truck through the computer.
Your best option is to use a lightweight embedded database (e.g. Berkeley DB Java Edition) to store your application state in. Of course if your application state is very big (say, you’ve got thousands of concurrent users), you might need a more elaborate solution.
Note that you will still inevitably lose some application state, basically anything since the last save.