Java Web应用程序中的Quartz与ScheduledExecutorService [英] Quartz vs. ScheduledExecutorService in Java web application

查看:167
本文介绍了Java Web应用程序中的Quartz与ScheduledExecutorService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于监视当前在命令行上运行并使用 ScheduledExecutorService ,我想编写一个简单的Web应用程序版本,以 Servlet容器,如 Apache Tomcat Eclipse Jetty

For a system monitoring Java application which currently runs on the command line and uses ScheduledExecutorService, I would like to write a simple web application version, to be run in a Servlet container like Apache Tomcat or Eclipse Jetty.

我读过 Quartz 作为Web应用程序的流行作业调度程序之一。将此应用程序从 ScheduledExecutorService 移植到Quartz会更好(可能是因为更好的servlet容器集成)吗?

I have read about Quartz as one of the popular job schedulers for web applications. Would it be better (maybe because of better servlet container integration) to port this application from ScheduledExecutorService to Quartz?

向应用程序添加另一个库依赖项不是问题,我对使用 ScheduledExecutorService 的技术原因感兴趣。

Adding another library dependency to the application is not a problem, I am interested in technical reasons against usage of ScheduledExecutorService.

推荐答案

这取决于你使用它的原因。

It depends on what you are using it for.

Quartz对于编程时间非常有用,例如:每小时一小时。

Quartz is useful for programmed times e.g. every hour on the hour.

ScheduledExecutorService对于重复不必在特定时间发生的任务非常有用。它更简单,可能更有效。如果你有这个工作,它告诉我你不需要Quartz。

ScheduledExecutorService is useful for repeating tasks which don't have to occur at a specific time. Its simpler and possibly more efficient. If you have this working it indicates to me that you don't need Quartz.

这篇关于Java Web应用程序中的Quartz与ScheduledExecutorService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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