开发者

Handling exception logging in a Java task scheduler program?

开发者 https://www.devze.com 2023-04-04 14:32 出处:网络
I need to design a Task SchedulerWhere 1) User should be able to schedule multiple task at the same time.

I need to design a Task Scheduler Where

1) User should be able to schedule multiple task at the same time.

2) There should be proper error handling on failure of any task and should not affect the other running tasks.

I found the related programme at http://www.roseindia.net/java/example/java/util/CertainAndRepeatTime.shtml

My concern is about handling of point 2 in program provided at above link. 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开发者_C百科 at 8 am. I want to log it in log file with task name and time details. Now if I look at above programme i.e CertainAndRepeatTime.java. This program will exit once it schedules all the tasks. Where and how should handle the logging?


You should have a look at the Quartz scheduler.


Definitely Quartz, as Thomas Jung already said. Check out Citrine, a web management layer on top of Quartz.


You should handle it like every other thread. Some try-catch-logging in the run method of the TimerTask.

0

精彩评论

暂无评论...
验证码 换一张
取 消