java调度器还有其他方法比Quartz更容易理解吗?
我创建了一个小型 java 程序,我想每天下午 1 点启动它。 我可以添加它 Windows 任务计划器,它工作得很好,但我想用 java 来做。
java的定时器任务好像不太好。
我听说过 Quartz,当我尝试它们时,它对我来说似乎很复杂,或者我找不到简单的示例或教程。
任何人都可以比 Quartz 网站更容易地了解一些好的教程或示例代码。 或者将我重定向到其他网站。
I've created a small java program and I want to launch it everyday at 1 o'clock.
I can add it windows task plannifier and it works very well but I want to do it with java.
The java timer task seems to be not good.
I heard about Quartz and when I try their it seems to be complicated for me or I don't find the simple example or tutorial.
Can anyone know some good tutorial or example code easier than the Quartz's site.
Or redirect me to some other site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Quartz 和内置的 Timer 类都不是为了启动整个应用程序而构建的。它们被构建为只要您的应用程序正在运行,就可以根据某个时间表运行某些指定的任务。
要在指定时间实际启动您的应用程序,需要外部资源(除非您希望应用程序始终运行并且只经常执行某些活动)。
为此,Windows 任务计划程序就足够了。
Both Quartz and the built in
Timer
class are not built to start your whole application. They are built to run some specified tasks according to some schedule as long as your application is running.To actually start your application at a specified time, an external resource will be necessary (unless you want your application to run at all times and only do some activity ever so often).
For that purpose the Windows Task Scheduler is sufficient.
Quartz
Quartz 是一个功能齐全的开源作业调度服务,可以与几乎可以支持任何 Java EE 或 Java SE 应用程序。
基本术语是(从非常基本的角度来看):
调度程序:您可以将其视为核心容器或石英基础的东西。
Job:你可以认为这是我们需要做的任务,简单的java类
触发器:让Job在调度程序上运行的东西,有两种类型的触发器使用quartz
另请参阅
Quartz
Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application.
The basic terminology are (at very basic view):
Scheduler : You can think of this as the core container or something that is the base of quartz.
Job : You can think this as the task we need to do , out simple java Class
Trigger : Something that will make Job to run on scheduler, there are two types of trigger with quartz
Also See
unix 中的 cronjob
每天在特定时间安排作业
cron
的基本用法是在特定时间执行作业时间如下所示。这将执行
sample_java_program
每天凌晨 1 点。
cronjob in unix
Scheduling a Job For a Specific Time Every Day
The basic usage of
cron
is to execute a job in a specifictime as shown below.This will execute the
sample_java_program
everyday at 1am.
cron4j 是另一个
cron4j is another one
当你说:
Quartz 和内置的 Timer 类都不是为了启动整个应用程序而构建的。
所以我永远无法使用 Quartz 或 Timer 启动我的整个 java 程序。
它只在我的 prg 运行时启动一些特定的任务?
那么保留 Windows 任务计划程序会更好吗?
好的,谢谢
When you say:
Both Quartz and the built in Timer class are not built to start your whole application.
So i could never launch my whole java program with Quartz or Timer.
it only launches some speicfic task while my prg is running?
so it's better to keep Windows task Scheduler?
ok thank you