Hi, I am trying out <#C01D6HTPATV|> and building a...
# random
k
Hi, I am trying out #C01D6HTPATV and building a basic text editor. I wanted to add auto save functionality to it. Is there any existing library for this? If not, can someone please help me with the approach.
e
You could use Java's standard library Timer API to create a task which would execute every N seconds to save the in-memory contents to disk
👍 1
k
Thanks @edrd. I was wondering how can I handle app crash or system failure? 🤔
e
You mean inside this recurring task?
k
Yeah
e
It depends if you want to recover or let the app crash
k
Lets sat if app crashes between two save cyles
Or system shuts down for some reason
e
Well, some level of loss will happen... what you can do is minimize it by having a task that runs more frequently
k
Yeah
e
I'd invest on proper error handling (try to use almost zero exceptions) and short autosave cycles
👍 1
k
Isn't Intellij a swing based application? I can probaby refer the intellij community repo on how they are handling it.
e
Yes... that could be an inspiration, although the IntelliJ repo is huge...
k
Yup 😂 Wondering if anyone from intellij team can help.
e
Well, they're a quite busy team... not sure 😛
n
IntelliJ is Swing based, and doesn't use Compose Desktop.