Reputation: 559
I wrote a REST server application using Jersey, and I deployed on CloudBees. Since I have a free account the server will go to sleep after 2 hours of inactivity. Before this happens I would like to save data on a database; how could I detect the sleep event on the cloudbees server? Thanks for your answers!
Upvotes: 0
Views: 96
Reputation: 2633
Getting application to hibernate is a standard servlet container shutdown, so a ServletContextListener can handle this. Another option is for you to have a periodic Timer task to store data on DB, as application may also just crash for various reason, and you'd them have data lost
Upvotes: 1