且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java EE中的定时批处理有哪些工具?

更新时间:2023-12-03 13:02:40

您应该从OpenSymphony查看开源 Quartz库。非常容易使用,非常适合这种事情。

You should look at the open-source Quartz library from OpenSymphony. Very easy to use and perfect for this kind of thing.

TimerTasks最适合在未来短时间内运行。但是对于像这样的大型时间框架的重复执行,Quartz擅长。您甚至可以将即将到来的任务列表保存在持久存储中,例如文件或数据库,因此如果您的应用程序重新启动,即将到来的定时作业也不会丢失。

TimerTasks are best suited for running something in a short time in the future. But for a repeated execution in a large timeframe such as this, Quartz excels. You can even keep your list of upcoming tasks in persistent storage such as a file or database, so upcoming timed jobs are not lost if your application is restarted.

此外,还有在Spring框架中为Quartz提供了一个很棒的抽象。

Also, there's a fantastic abstraction for Quartz in the Spring framework.