Java EE中的定时批处理有哪些工具? [英] What tools are there for timed batch processes in Java EE?

查看:304
本文介绍了Java EE中的定时批处理有哪些工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的雇主刚要求我在他们运行的Java EE WebSphere应用程序中运行定时批处理。它应该在每天晚上11:30运行某个类。

My employer just asked me to run a timed batch process in a Java EE WebSphere application they have running. It's supposed to run a certain class at 11:30 pm everyday.

我不熟悉Java EE或WebSphere服务器(或tomcat,在开发环境中) ,我一直在挖掘,但我发现的只是关于java计时器类,但不是如何设置或调用它。

I'm not very familiar with Java EE nor WebSphere server (or tomcat, in the development environment), and I've been digging around but all I've found is about the java timer class but not how to set it or invoke it.

似乎编辑了web.xml文件也是必需的。

It seems that editing the web.xml file is required as well.

任何帮助将不胜感激!

推荐答案

您应该从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.

这篇关于Java EE中的定时批处理有哪些工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆