I am a beginner in java spring-boot when I start the java server through nohup java -jar demo-0.0.1-SNAPSHOT.jar command my threads start their operations After sometimes when I stop my server using kill -9 processid So my running thread data are lost. I want to maintain a thread flag in the database whenever server stops. I have tried to achieve