简体   繁体   English

在Java Task Scheduler程序中处理异常日志?

[英]Handling exception logging in a Java task scheduler program?

I need to design a Task Scheduler Where 我需要在哪里设计任务计划程序

1) User should be able to schedule multiple task at the same time. 1)用户应该能够同时安排多个任务。

2) There should be proper error handling on failure of any task and should not affect the other running tasks. 2)任何任务失败时都应进行适当的错误处理,并且不应影响其他正在运行的任务。

I found the related programme at http://www.roseindia.net/java/example/java/util/CertainAndRepeatTime.shtml 我在http://www.roseindia.net/java/example/java/util/CertainAndRepeatTime.shtml找到了相关程序

My concern is about handling of point 2 in program provided at above link. 我关心的是上面链接提供的程序中第2点的处理。 Say I schedule a recurring mail send process in above program which will be run first time on 12 september 2011 at 2 am, and will be repeated after every 2 hours Say a one process fais at 8 am. 假设我在上述程序中安排了定期发送邮件的过程,该过程将在2011年9月12日凌晨2点首次运行,并且每2小时重复一次。说在上午8点有一个过程。 I want to log it in log file with task name and time details. 我想用任务名称和时间详细信息将其记录在日志文件中。 Now if I look at above programme ie CertainAndRepeatTime.java. 现在,如果我看上面的程序,即SomeAndRepeatTime.java。 This program will exit once it schedules all the tasks. 计划所有任务后,该程序将退出。 Where and how should handle the logging? 在哪里以及如何处理日志?

您应该看一下Quartz调度程序

Definitely Quartz, as Thomas Jung already said. 正如Thomas Jung所说的,绝对是石英。 Check out Citrine , a web management layer on top of Quartz. 查看Citrine ,这是Quartz之上的Web管理层。

You should handle it like every other thread. 您应该像处理其他所有线程一样处理它。 Some try-catch-logging in the run method of the TimerTask. TimerTask的run方法中的一些try-catch-logging。

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

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