开发者

schedule two FixedRate task

Hi: In my application,I have to export tomcat log to database.

So I tried to start two schedulFixedDate task:

1)at 00:05:00 of everyday,export dat开发者_如何学编程a of nearest 30 days(exclude today(current day)),all these data are put in one table.This is the first schedule task

2)first remove all the data in the "log_today" table,then export log of current day to "log_today" table hour by hour,at 01:00/02:00/03:00/... this is another schedule task;

My question is should the two task be separated with the other? or they should executed by some order?


Depends on your use case.

If you need task 1 to finish before task 2, then scheduling at a fixed time/date won't work, because you cannot be sure Task 1 completed. So, in this case it would make sense to run them as a single schedule, and perform task 2 immediately after task 2.

If task 2 does not rely on task 1, then put them as two fixed schedules, as it is clearer and therefore easier to maintain.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜