简体   繁体   English

安排Java中某些任务的最佳方法

[英]Best way to schedule certain task in Java

I'm working on Java web application which requires running certain task (mysql query) once a day. 我正在研究Java Web应用程序,该应用程序每天需要运行某些任务(mysql查询)。 What is the best way to do such thing in Java? 用Java做这种事情的最好方法是什么?

I saw something like Quartz but I'm not sure if it is ok for job like this. 我看到了类似Quartz的东西,但是我不确定是否可以进行这样的工作。 With quick review it looks like quartz requires initialization. 快速查看后,石英似乎需要初始化。 Can it be done with web application? 可以使用网络应用程序吗? What about downtimes? 停机时间如何?

quartz is a great solution (the documentation tells you how to start it in a servlet container). quartz是一个很好的解决方案( 文档告诉您如何在servlet容器中启动它)。 it's also a very popular solution so there is plenty of documentation online. 这也是一个非常受欢迎的解决方案,因此在线上有很多文档。

if you are running within a full j2ee container, there is a built in timer service. 如果您在一个完整的j2ee容器中运行,则有一个内置的计时器服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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