Hamza Yerlikaya
Hamza Yerlikaya

Reputation: 49339

Java Calendar scheduling events

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 calendar 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 calendar that way.

What is a good way to solve this?

Upvotes: 0

Views: 2375

Answers (2)

Zsolt Török
Zsolt Török

Reputation: 10439

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.

Upvotes: 2

Nathan Kitchen
Nathan Kitchen

Reputation: 4877

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.

Upvotes: 1

Related Questions