简体   繁体   中英

Entry point for java web application

I need to know where i can start a cron in my java web app. I need this cron to run daily and be rescheduled if the server restarts. Do java web application have hook where i can do this?

----edits----

Im using quartz to schedule a task which will pull down and parse a csv file and store it in a database. I need to know where i should schedule it to run the first time

You might want to use a ServletContextListener . It supports two methods that run when an web app is started and ended. This article goes over setting one up. You can start the Quartz scheduler in the Initialize method and shut it down in the Destroy method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM