views:

183

answers:

2

In my application i want to schedule the start of processing. In two ways first on a preset date or say like every Monday. In the case of a single date i can watch the time on a tread and start processing but when two are mixed i can't come up with a good solution.

My initial thought was when application boots up i can schedule events to calender and check if there is job to do every min or so, that would work for both single date and every week case turns out i can not use the calender that way.

What is a good way to solve this?

A: 

Look at java.util.Timer. It allows you to schedule tasks for execution at a specified time on a background thread, and it support recurring events.

Nathan Kitchen
+1  A: 

Quartz is an open-source job scheduling component written in Java, you might want to check that out.
Its features range from simple timers to full-blown CRON expressions, and it's used extensively by the JBoss AS.

Zsolt Török