Also: https://stackoverflow.com/a/54804806/2431728 “”” Daemon threads are sometimes mistakenly used by beginners who don't want to think about shutdown actions. However, this can be dangerous. A daemon thread should never access a persistent resource such as file or database since it can terminate at any time, even in the middle of an operation. “”"