Dumping a Java program into a file and restarting it

后端 未结 10 1013
温柔的废话
温柔的废话 2020-12-29 08:30

I was just wondering if it\'s possible to dump a running Java program into a file, and later on restart it (same machine)

It\'s sounds a bit weird, but who knows

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 08:38

    First off you need to design your app to use the Memento pattern or any other pattern that allows you to save state of your application. Observer pattern may also be a possibility. Once your code is structured in a way that saving state is possible, you can use Java serialization to actually write out all the objects etc to a file rather than putting it in a DB.

    Just by 2 cents.

提交回复
热议问题